A comparison of CSS minification engines.
Most of the time crass
comes first although clean-css
, cssnano
and csso
come close. Test the minifiers with your CSS to find what works best for you.
Clone the repository, install the dependencies with npm install
and then run node ./bin/bench
. That's it!
If you prefer to see results without cloning the repo here are the most recent ones.
Just run node ./bin/bench --html > report.html
Just copy your file to the data
directory (make sure the filename ends with .css
) and re-run the benchmark.
Please make sure your file does not contain any special comments (/*! ... */
) since not all minifiers strip them correctly:
clean-css
is configurable, but leaves all by defaultcsso
always leaves one
- add it to
package.json
as adevDependency
- run
npm install
- require it in
lib/minify.js
and add it tominifiers
hash - run
npm run bench
- add it to this file in "Which engines are covered?" section above
- send a PR (if you wish to have it included)
Just run node ./bin/bench --only csso,cssnano
(it's turned into /.*(csso|cssnano).*/
regex)
Run node ./bin/bench --gzip
to measure the gzip size instead of the regular file size.
css-minification-benchmark is released under the MIT License.