PostCSS plugin to remove rules and declarations from stylesheets.
/* Input */
.foo {
background-color: black;
}
#bar {
width: 100%;
}
@remove #bar;
.foo {
@remove background-color;
background-color: black;
}
/* Output */
.foo {}
.foo {
background-color: black;
}
Also works inside media queries:
/* Input */
.foo {
color: blue;
}
@media screen and (min-width: 750px) {
.foo {
color: black;
}
.bar {
text-decoration: blink;
}
}
@media screen and (min-width: 750px) {
.foo {
@remove color;
color: red;
}
@remove .bar;
}
/* Output */
.foo {
color: blue;
}
@media screen and (min-width: 750px) {
.foo { }
}
@media screen and (min-width: 750px) {
.foo {
color: red;
}
}
postcss([ require('postcss-remove-nodes') ])
See PostCSS docs for examples for your environment.