The JavaScript CompressorRater
When I release a new version of my SPServices library, I always release two versions: the regular JavaScript/jQuery file and the minified version of the same. Minification “squishes” the scripts down, removing comments, white space, etc. so that you can send as few bytes down the wire as possible to keep page load times snappy.
In my roaming around on the Interwebs to find a good minification engine months ago, I ran across The JavaScript CompressorRator. The really nice thing about it is that it will submit your script to multiple minification engines and show you which ones do the best job. Every script is different, so each script will be minified by each algorithm somewhat differently.
You can choose which result you like the best and use it.
UPDATE 2010-06-23: I’m in the habit of using the third option in the image below (YUI Compressor 2.4.2 with no options). When I first started working on SPServices and releasing it with a minified version, that one was the winner in terms of size. I also had some problems with a couple of the other choices, which I tracked down to some problems in my code as opposed to the minification method I was using. In any case, I think that smaller is indeed better. I’ve just decided to stick with the one method over time, figuring that it’s a known quantity.
Microsoft has a tool called AjaxMin that can compress your script files smaller then you currently have them.
Thanks, David. I’ve seen AjaxMin before, and to me it’s too much of a .NET developer tool to have general usefulness. One of the things that I like about The JavaScript Compressorator is that it makes sense to someone who doesn’t live and die by the command line or in Visual Studio.
M.
You haven’t mentioned which one you prefer to use and why? Is it as simple as “smaller the better” or is there more to it?
Thanks for the post, I didn’t know about this service!
Alex:
Thanks for the question. I’ve just updated the post with more info about what I use.
M.
Marc, thank you so much for your time and dedication to all users… Thanks…