$ npm install postcss-merge-rules
Merge CSS rules with PostCSS.
With npm do:
npm install postcss-merge-rules --save
This module will attempt to merge adjacent CSS rules, rules with the same selector, or @media, @supports or @container blocks with the same condition that are separated only by unrelated rules:
a {
color: blue;
font-weight: bold
}
p {
color: blue;
font-weight: bold
}
a,p {
color: blue;
font-weight: bold
}
a {
color: blue
}
a {
font-weight: bold
}
a {
color: blue;
font-weight: bold
}
Unrelated rules between the two merged rules are left in place. A rule that sets a property a later rule also sets stops the merge, because the cascade order would change.
a {
color: blue
}
p {
margin: 0
}
a {
font-weight: bold
}
a {
color: blue;
font-weight: bold
}
p {
margin: 0
}
a {
font-weight: bold
}
p {
color: blue;
font-weight: bold
}
a,p {
font-weight: bold
}
p {
color: blue
}
See the PostCSS documentation for examples for your environment.
See CONTRIBUTORS.md.
MIT © Ben Briggs
© 2010 - cnpmjs.org x YWFE | Home | YWFE