A code is worth a thousand words

Minify JavaScript from command line

You are here

This snippet shows how to minify javascript files from command line. Minifying JavaScript is useful in many respects. Most important are security and performance. Security is increased due to the fact that minified javascript is harder to read, minification renames your variables to shorter ones and that can hide some business logic. Secondly minification leads to smaller files and that gives less bandwidth usage (useful for large sites) and you spend less time downloading the file. This is pretty much essential for bigger websites and why not smaller ones as well. Javascript minifier tool closure works very well. Also don't forget to keep the original.