ben-eb / css-minification-benchmark

A comparison of CSS minifiers for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linux Build Status devDependency Status

What is css-minification-benchmark?

A comparison of CSS minification engines.

FAQ

Which engines are covered?

What are the results?

Most of the time more-css comes first although clean-css and csso come close. Test the minifiers with your CSS to find what works best for you.

How can I see the results?

Clone the repository first then run ./bin/bench. That's it!

Note that on Windows you will need to do node ./bin/bench

If you prefer to see results without cloning the repo here are the most recent ones.

How can I generate the html remport

Just run ./bin/bench --html > report.html

How can I test my CSS file?

Just copy your file to data directory (make sure 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 has it configurable but leaves all by default
  • csso always leaves one
  • ncss and ycssmin always leave all

Can I get the total size and time for my CSS files?

Copy all you files to data directory like before and run the benchmark with --total.

How can I add a new minifier to the list?

  • add it to package.json as a devDependency
  • run npm install
  • require it in lib/minify.js and add it to minifiers hash
  • re-run the benchmark
  • add it to this file in "Which engines are covered?" section above
  • send a PR (if you wish to have it included)

How can I compare a subset of minifiers

Just run ./bin/bench --only ncss,ycssmin (it's turned into /.*(ncss|ycsmin).*/ regex)

Can I get the compressed gzip size as well?

Run ./bin/bench --gzip to measure the gzip size instead of the regular file size.

License

css-minification-benchmark is released under the MIT License.

About

A comparison of CSS minifiers for node.js

License:MIT License


Languages

Language:CSS 96.5%Language:JavaScript 3.5%