I need to minify my jquery plugin code to reduce filesize; Can anyone suggest a good tool?
|
|
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 |
||
|
|
|
|
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. |
||
|
|
|
|
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 |
||
|
|
