Minify command-line tool

While creating the jQuery plugin "onScreen" I had a sudden burst of inspiration and hacked together a quick command-line script to minify JavaScript files. It's a really simple way to generate a .min.js version of a file and is particularly helpful when distributing JavaScript like the aforementioned jQuery plugin.

At its most simple you can pass a single argument which is the path to the JavaScript file to minify, a .min.js version will be created for you in the same directory. So the following will create jquery.myplugin.min.js:

$ minify jquery.myplugin.js

You can also pass more paths and it will concat and minify them into a single file - the last argument is always the output file: