Minify JavaScript via UglifyJS

UglifyJS is a JavaScript minifying tool, which runs on NodeJS. Compared with other popular JavaScript minifiers, such as YUI Compressor and Google Closure, a remarkable advantage of using UglifyJS is that it’s available as a native command. To utilize UglifyJS, we need to install NodeJS first and then the UglifyJS module.

Here is the guideline on installing NodeJS After successful installation, node server starts running.

Then, install UglifyJS module on the node server. After adding the UglifyJS path into PATH, we are able to use it via command prompt:

$ uglifyjs -nc -o [output js] [input js]

Extremely easy, isn’t it? Following is a small test comparing the compressing efficiency of different minifiers:





YUI Compressor


193.5 KB

62.3 KB

61.3 KB

64.4 KB



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s