Is there a good JavaScript minifier? [closed]
What JavaScript minifier do you recommend?
UglifyJS2, used by the jQuery project.
Active
- Closure Compiler
- UglifyJS2
Deprecated
- YUI Compressor
- UglifyJS
Google Closure Compiler generally achieves smaller files than YUI Compressor, particularly if you use the advanced mode, which looks worryingly meddlesome to me but has worked well on the one project I've used it on:
Several big projects use UglifyJS, and I've been very impressed with it since switching.
JavaScript Minifier gives a good API you can use programatically:
curl -X POST -s --data-urlencode 'input=$(function() { alert("Hello, World!"); });' http://javascript-minifier.com/raw
Or by uploading a file and redirecting to a new file:
curl -X POST -s --data-urlencode '[email protected]' http://javascript-minifier.com/raw > ready.min.js
Hope that helps.