E-com DevBlog Spider-ball-vacuum

4Jun/080

A slightly closer look at JSMin

a-slightly-closer-look-at-jsmin

A month or three ago I did a post on different JS compression utilities.  At that time I had decided that the YUI compressor was the best.

"In my opinion YUI is the best, you can choose several different compression levels and it works very well compressing prototype, so well in fact that we got it to shrink down an extra 10k than what had been done with  ShrinkSafe.  Also the YUICompressor is semi-intelligent with whitespace, it checks for ascii characters before and after a piece of whitespace to know if it should remove it."

After learning a bit more, I haven't completely changed my mind, but I thought that I would mention JSMin a bit more. The main reason for this second look is that when combined with gzip (or deflate), JSMin really is a wonderful solution to compressing your javascript files (and the solution recommended by the jQuery team).

Speaking of jQuery, you can use JSMin to shrink the jquery.js down from 95k to 53k. Then you can use gzip on your server and it will crunch down to about 15k! I haven't tried using gzip on a yui compressed file, but it may have the same problems that a PACKED js file has. Meaning gzip either won't work on it, or your functions will "esplode".

You can grab JSMin here (at the time of this post, the link to download the file is at the bottom of the page).

Print This Post Print This Post
20Feb/080

JS Compressors

So Jason found that one of the compressed versions of prototype we were using was causing some function to not work. The prototype file in question had been shrinked using ShrinkSafe, which is based on Rhino, and is actually made by dojo (I figured since IBM has a dark-alliance with dojo, it'd work fairly well with Websphere. Needless to say, ShrinkSafe is well... crap. So here is what you should use instead.

*Now I didn't link to the jsmin or to YUI because they could be updated, and they are files you run locally on your box while /packer/ is a copy-paste web-util.

In my opinion YUI is the best, you can choose several different compression levels and it works very well compressing prototype, so well in fact that we got it to shrink down an extra 10k than what had been done with  ShrinkSafe.  Also the YUICompressor is semi-intelligent with whitespace, it checks for ascii characters before and after a piece of whitespace to know if it should remove it.

Print This Post Print This Post