clean-css icon indicating copy to clipboard operation
clean-css copied to clipboard

"mergeNonAdjacentRules" not works in some cases

Open GoodDayForSurf opened this issue 3 years ago • 0 comments

Environment

  • clean-css version: 5.3.2
  • node.js version: v18.12.1
  • operating system: Win10

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({"level": {2: { mergeNonAdjacentRules: true } } })

Input CSS

.selector .title {
  border: 0;
}
.wrapper .container {
  padding: 0;
}
.other{
   border-radius: 1px;
}
.selector .title {
  padding: 1px;
}

Actual output CSS

.selector .title {
  border: 0;
}
.wrapper .container {
  padding: 0;
}
.other{
  border-radius: 1px;
}
.selector .title {
  padding: 1px;
}

Expected output CSS

.wrapper .container {
  padding: 0;
}
.other{
  border-radius: 1px;
}
.selector .title {
  border: 0;
  padding: 1px;
}

If you replace border-radius with any other property, the merge will work as expected.

GoodDayForSurf avatar Jan 20 '23 22:01 GoodDayForSurf