Minimizer to Reduce Download Size of CSS and JS Files

December 31, 2015

My go-to tool for minimizing CSS files is YUI compressor. It's a java application that I run locally, usually aided by a simple shell script, as follows. It can also be used for JavaScript minification. You'll be looking for something like this if you use Google's PageSpeed Insights where it will undoubtedly want this stuff minimized if it's large.

java -jar ../tools/yuicompressor-2.4.8.jar default.css -o default.min.css

This will remove all whitespace from the CSS file, making it basically unreadable, but dropping the size of the file. It drops the default.css file on this site from 19K to 14K.

Related Posts