compressing javascriptThere are a couple of reasons you may want to compress your Javascript code.
First is that by compressing your code there is less information to transfer to your users. This helps reduce the bandwidth and load on your server. And it make your pages feel faster to the end user. Second, Javascript code can not be protected. Once it's out there, everyone can see the source. If you want to help slow people down from using your cool tricks, the obfuscation that results from compression can help. It's far from full-proof, but it may dissuade the casual person who's poking about. If you want to compress your Javascript code, there's a new package out that will probably the standard soon. It's called ShrinkSafe and it's from the people who bring you Dojo. The big advantage of ShrinkSafe is that it's based on a Javascript interpretor (Rhino), not just a bunch of regular expressions. So it has the capability to make absolutely sure that the compression does not affect the functionality of your code. The other nice thing about it is that it offers both a web interface, and a desktop application version, so you can use it as a service if you like or not. The web service is nice also in that it allows you to compress multiple files at one time. You can check it out here: http://shrinksafe.dojotoolkit.org/
|

