
Better JavaScript Minification - sant0sk1
http://www.alistapart.com/articles/better-javascript-minification/
======
Groxx
Title should probably be "Better JavaScript Minification _with YUI_ ". It's
just about ways to hack around YUI to improve its compression (ie, what to
avoid, because it trips up YUI).

Or, ya know, you could just use another library. Like Closure:
<http://code.google.com/closure/>

(anyone used Closure? Know how good it is?)

~~~
axod
[http://axod.blogspot.com/2010/01/google-closure-compiler-
adv...](http://axod.blogspot.com/2010/01/google-closure-compiler-advanced-
mode.html)

In my tests, it's _extremely_ good. It requires some effort to get things
working with the advanced mode, but it's worth it to make things load quicker.

Certainly far better than YUI.

~~~
TeHCrAzY
I've had it break (without generating any warnings) some javascript just this
morning using the simple mode (haven't had the time to sit down and look at
exactly what was broken). So I would urge a great deal of caution in using it:
test, test, test!

~~~
axod
I haven't seen any issues with simple mode, but I would echo that. It can
seriously mess things up if anything goes slightly wrong, so you need rigorous
testing in place.

Advanced mode can remove code you're using, it can rewrite variables you don't
want rewritten, etc so you need to be sure everything is understood before you
start.

But the rewards are worth it...

No compression: 92K, YUI: 56K, Closure Advanced: 47K.

