Sunday, March 26, 2006

ShrinkSafe - JS Compression

ShrinkSafe is a JavaScript "compression" system. It can typically reduce the size of your scripts by a third or more, depending on your programming style.

Many other tools also shrink JavaScript files, but ShrinkSafe is different. Instead of relying on brittle regular expressions, ShrinkSafe is based on Rhino, a JavaScript interpreter. This allows ShrinkSafe to transform the source of a file with much more confidence that the resulting script will function identically to the file you uploaded.

1 comment:

Maninder (Mandy) Singh said...

Jonathan,

I would say that if you are on apache then just go ahead with using gzip. There is nothing better than that cos -

1. It would shrink the size by as much as 1/3rd.

2. It would not alter the code (like ShrinkSafe) so debugging would still be easy.

ShrinkSafe from dojo is good but it also changes the function names internally so debugging can be a pain when js errors are noticed.

JSMin is better (I think) but again it requires that you use certain style of writing (which should be checked against JSLint again by Douglas Crockford) and only then would JSMin run on your code (it's just to prevent errors).