This article is a review of the tools and processes that I have tested and gives plusses and minuses of each.
|Closure Compiler||39K||16K||59%||with ADVANCED_OPTIMIZATIONS|
java -jar yuicompressor-2.4.7.jar --type js -o filename_yui_min.js filename.js
The google closure compiler is the most advanced of the ones that I tested. It has a simple mode that doesn’t break code and an option for ADVANCED_OPTIMIZATIONS that produces very compressed code. Here is an example command for using the closure compiler in simple mode:
java -jar compiler.jar --js filename.js --js_output_file filename_closure_min.js --externs externs.js
And similarly for advanced mode:
java -jar compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --js filename.js --js_output_file filename_closure_min.js --externs exterms.js