JS minify scripts

2011-01-09 16:18:00

Just a bunch of links to various js minifiers. Some are better than others, but it usually just depends every time.

If you're going for best compression I'd advice google closure and microsoft ajax minifier. In my js1k demo, the ajax minifier won, but it's very well possible (and probable) that it'll differ for larger projects. (I'm told even uglify can do better than google closure.)

If, after that, you're still looking to win bytes, I suggest to look at the crush line of minifiers, which use some compression algorithm to pack and eval to revive the script. Not pretty, but it does the job. In my experience, jscrush wins here, hands down.

Note: these are all web-based minifiers. Some use server requests, others do it all on the client. None use downloadable executables.

Simple whitespace
jsmin

Identifier shortning
YUI compressor
packer (this is 3.1, 3.0)
shrinksafe (dojo)

Smart compilers
Microsoft Ajax Minifier (also has YUI)
Google Closure
uglify js

Eval compression
jscrush
js crunch

Code verification/feedback (ok, not minify, but hey..)
jslint
jshint
javascriptlint
docterjs
compressor rater
jscheck

Misc
jsbeautifier
js utility (bit of everything, powered by jslint)
js parser with output (blatant self plug ;)
js coercion tool

Important ones missing? Ping me on twitter.

Hope it helps you!