Squish it good - Code compression for the masses
Labor Day came and I completely forgot that it would mean no Monday morning for writing a post. Hope you all had great beer and burgers, or whatever you were doing.
In the meantime, I’d like to mention something cool. Julien LeComte has released his YUI Compressor that includes a CSS minification script that I built here for internal use.
Compression is a little more than just minifying. Julien’s compressor also shortens all local variable names, resulting in significant improvements over minification alone, but without the bug-risks of obfuscation.
It’s interesting to me that his tests show that compression is actually more effective than obfuscation when the code is gzipped. I’m not enough of a gzip scholar to know why that is, but in my mind at least, it shuts packer’s Base 62 encoding out of the running. Additionally, in my (non-scientific, not statistically significant, but probably still accurate) tests, packer adds a significant amount of run-time due to the convolutions of eval and a needless large Regex. You need to have pretty big download gains in order to make it worth putting the browser through that extra work.
The CSS Compressor that I wrote doesn’t do what CSS Tidy does. There are a few steps that could be taken from CSS Tidy, like shortening
margin:1px 1px 1px 1px to just
code beautycode ecosystems