This question is tagged with
~ Asked on 2008-08-26 19:36:20
Node.js internals). It's a lot faster than both YUI Compressor and Google Closure, it compresses better than YUI on all scripts I tested it on, and it's safer than Closure (knows to deal with "eval" or "with").
Other than whitespace removal, UglifyJS also does the following:
PS: Oh, it can "beautify" as well. ;-)
~ Answered on 2010-08-22 14:50:31
Revisiting this question a few years later, UglifyJS, seems to be the best option as of now.
--- Old answer below---
Previous to that the various options were as follow
The tests were done on jQuery code btw.
~ Answered on 2008-08-26 19:48:34
YUI Compressor is the way to go. It has a great compression rate, is well tested and is in use among many top sites, and, well, personally recommended by me.
I've never used its CSS compression capabilities, but they exist as well. CSS compression works just as well.
~ Answered on 2008-08-26 19:39:44
I actually have an MSBuild task in a Web Deployment Project in my current Visual Studio solution that runs a script which in turn runs all of the solution's JS files through ShrinkSafe before we deploy and it works quite well.
EDIT: By the way, "best" is open to debate, since the criteria for "best" will vary depending on the needs of the project. Personally, I think ShrinkSafe is a good balance; for some people that think smallest size == best, it will be insufficient.
EDIT: It is worth noting that the YUI compressor also uses Rhino.
~ Answered on 2008-08-26 20:03:40
Try JSMin, got C#, Java, C and other ports and readily available too.
~ Answered on 2008-08-26 19:42:48
If you use Packer, just go far the 'shrink variables' option and gzip the resulting code. The base62 option is only for if your server cannot send gzipped files. Packer with 'shrink vars' achieves better compression the YUI, but can introduce bugs if you've skipped a semicolon somewhere.
base62 is basically a poor man's gzip, which is why gzipping base62-ed code gives you bigger files than gzipping shrink-var-ed code.
~ Answered on 2008-08-28 14:43:38
JSMin is another one.
~ Answered on 2008-08-26 19:41:56
In searching silver bullet, found this question. For Ruby on Rails http://github.com/sstephenson/sprockets
~ Answered on 2010-05-19 14:29:14
Js Crush is a good compressor to use after you have minified.
~ Answered on 2010-08-22 17:47:14
~ Answered on 2009-06-07 15:55:07
bananascript.com used to give me best results.
~ Answered on 2008-09-15 18:50:53
Here's the source code of an HttpHandler which does that, maybe it'll help you
~ Answered on 2008-08-26 19:48:33