http://code.google.com/p/closure-compiler/
http://stackoverflow.com/questions/28932/best-javascript-compressor
Google released Closure Compiler which seems to be generating the smallest files so far as seen hereand here Previous to that the various options were as follow Basically Packer does a better job at initial compression , but if you are going to gzip the files before sending on the wire (which you should be doing) YUI Compressor gets the smallest final size. The tests were done on jQuery code btw.
@daniel james mentions in the comment compressorrater which shows Packer leading the chart in best compression, so I guess ymmv |
|||
Closure Compiler
Closure Compiler is a JavaScript optimizing compiler. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. It is used in many of Google's JavaScript apps, including Gmail, Google Web Search, Google Maps, and Google Docs.
Try it out!
It's easy to try the compiler through our web application at http://closure-compiler.appspot.com/
Get the Compiler
Download the compiler at http://closure-compiler.googlecode.com/files/compiler-latest.zip or using Maven.
The zip file contains a README with quick instructions to get you started.
User Documentation
You can read more about Closure Compiler at http://code.google.com/closure/compiler/.
We also have a few low-key wiki pages at http://code.google.com/p/closure-compiler/w/list. Please suggest new ones if you see anything missing.
Developer Documentation
The Closure Compiler javadocs are available at http://closure-compiler.googlecode.com/svn/trunk/javadoc/index.html
You can browse the source at http://code.google.com/p/closure-compiler/source/browse/#svn/trunk
We accept patches :)
\uxxxx
literals by default.. use e.g.--charset UTF-8
(if you're sure you let the browser know about it somehow) – mykhal Feb 15 at 9:35