The Ashes
CSS Minification; Part 72; Alphabetizing
Ray Cromwell wrote that great piece on JS compression and how the GWT compiler does smart things.
Barry van Oudtshoorn has written a CSS minifier that uses some of the same concepts that Ray talked about (ordering for best compression). Here is Barry:
I recently wrote a small CSS minifier in Java that optimizes your CSS output for gzipping. Essentially, it does most of what the YUI compressor does, but additionally, it ensures that property values are always ordered consistently. This means that the gzip algorithm can reduce the file size further.
This is in accordance with Google’s Best Practices documentation
In my testing, my CSS minifier’s raw output is actually slightly larger than that of YUI, but when compressed, it is noticeably smaller, thanks to the gzip optimisations. As this is the an early release, however, I have plans for various optimizations to the raw output which will further reduce its size, which in turn will help to reduce the gzipped size of the file even further.
The code is released under the MPL, and is freely downloadable from my website, at the address linked to above.
No Comments