Skip to content

Restructuring causing merged style rules to be overwritten #830

@xeonicca

Description

@xeonicca

Using clean-css@3.4.20 with the following rules:

.button--black {
  color: tomato;
  border-color: black;
  border-bottom-color: rgba(0, 0, 0, .2);
}

.button--blue {
  color: tomato;
  border-color: blue;
  border-bottom-color: rgba(0, 0, 0, .2);
}

will be minified into the following (unminified for readability):

.button--black, .button--blue {
  color: tomato;
  border-bottom-color: rgba(0, 0, 0, .2);
}

.button--black {
  border-color: #000;
}

.button--blue {
  border-color: #00f;
}

See the border bottom color will be overwritten because the merged rule is moved aboved border-color:#000. While turning off restructuring the code works as intended, but is this considered a bug on clean-css?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions