postcss-clean
![NPM Monthly Downloads](https://camo.githubusercontent.com/f57e273858de68fd172f64e5f5960d8f2549279f73043016a5801f127bf266de/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f646d2f706f73746373732d636c65616e2e7376673f7374796c653d666c61742d737175617265)
PostCss plugin to minify your CSS
Compression will be handled by clean-css, which according to this benchmark is one of the top (probably the best) libraries for minifying CSS.
With npm do:
npm install postcss-clean --save
.try {
color: #607d8b;
width: 32px;
}
.try{color:#607d8b;width:32px}
:host {
display: block;
}
:host ::content {
& > * {
color: var(--primary-color);
}
}
:host{display:block}:host ::content>*{color:var(--my-color)}
Note this example assumes you combined postcss-clean with other plugins (e.g. postcss-nesting).
Note that postcss-clean is an asynchronous processor. It cannot be used like this:
var out = postcss([ clean() ]).process(css).css;
console.log(out)
Instead make sure your runner uses the async APIs:
postcss([ clean() ]).process(css).then(function(out) {
console.log(out.css);
});
It simply proxies the clean-css options. See the complete list of options here.
See the PostCSS documentation for examples for your environment.
Pull requests are welcome.
MIT © Leonardo Di Donato