(almost) all CSS minifiers available for node.js
This module provides a convenient list of the CSS minifiers that are out there for the Node ecosystem, should you need to compare minification results across engines. It has mostly been inspired from the minification benchmark, and provides a simple, normalised API for all available tools.
The only minifier that this does not cover is css-smasher; this is because this engine is too conservative about its parsing, leaving lots of whitespace in & not covering basic optimisations.
If you've written a minifier that you'd like to add to this list, please send a pull request!
Since version 2, all minifiers are wrapped with the Promise API:
var minifiers = require('css-minifiers');
var css = 'h1 { color: #880000; }';
var csso = minifiers.csso;
csso(css).then(function (output) {
console.log(output);
// => h1{color:#800}
});
Get a benchmark compression time:
csso.bench(css).then(function (output) {
console.log(output);
// => 1.4 ms
});
csso.bench(css, true).then(function (output) {
console.log(output);
// => 1.399856 ms
});
The version number & homepage for the engine are also exposed:
console.log(csso.version, csso.url);
// => 1.3.11 https://github.com/css/csso
With npm do:
npm install css-minifiers
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs