I need to minify my jquery plugin code to reduce filesize; Can anyone suggest a good tool?

asked Oct 23 '09 at 20:48

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1071117


Generally the best way to do it is to use the YUI compressor.

An alternative is to use Douglas Crockford's JSMin. This doesn't compress JavaScript code as small, but generally how you write your code matters less. jQuery also provides a pre-minified version of jQuery for your convenience.

Packing javascript using Dean Edwards' Packer (specifically using the base64 encode) is not recommended, as the client-side decoding has significant overhead that outweighs the file-size benefits.

If compressing your JavaScript breaks it, try running the code through JSLint. This will detect minor errors that can cause packed JavaScript to fail where the unpacked version works fine.

answered Oct 23 '09 at 20:49

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1071117

Also worth a mention is Dojo Shrinksafe.

To compare the decode times and compression ratios of the various compressors out there, you might want to take a look at CompressorRater

answered Oct 28 '09 at 21:51

Mark%20Boas's gravatar image

Mark Boas
311

Apparently Packer does a pretty good job even if you turn off the base62 encoding. Worth considering.

Also this is worth checking out : http://closure-compiler.appspot.com/home

answered Feb 08 at 15:18

Maboa's gravatar image

Maboa
1

Your answer
toggle preview

powered by OSQA