JavaScript compressor/packer

Are you doing JavaScript development and your JavaScript code has grown and grown? Have you ever looked at the available JavaScript compressors/packers?

On the weekend I have found a really nice one, it’s available as online version at http://dean.edwards.name/packer/ or can also be downloaded as .NET stand alone and it’s FREE!!!

I did a test and used it to compress the JavaScript files of my Oracle APEX – ApexLib development framework and the result is really astonishing!

All my JavaScript libraries together (with comments, …) 95.465 bytes
All my JavaScript libraries together where I manually removed all comments 44.120 bytes
Compressed with the above tool 19.161 bytes


Note:
Don’t forget to read the help for the tool, because your scripts have to comply to some restrictions.

So there is no excuse anymore not to comment your JavaScript code or to use 1 or 2 digit variable/method names, just to save a few bytes! Always remember that you have to maintain that code in a few months…

2 thoughts on “JavaScript compressor/packer

  1. Carl,

    the dojo Compressor looks also interesting!

    But i’m not sure if it really produces a more readable code, because debugging a code which has variables named _1, _2, … and no formating, no comments will be quite hard.

    That’s why I think the best solution for both compressors is to include a link to the uncompressed version of the JavaScript library at the top of the file.

    The linked JavaScript library can be used in case of debugging or digging and contains all the formating, comments, …

    Patrick

Comments are closed.