James John – Software Engineer

Sublime Minifier: Minify JS & CSS in Sublime Text

To me, I can say Sublime Text is the best IDE for programming! It’s really flexible and light, the first time I jumped into Sublime, I fell in love <3 😀 and now I’ve gotten another feature ;). My last post was about Minifying JS and CSS files with YUI Compressor and I mentioned that it’s no more maintained but what of UglifyJS? It’s still maintained and running with more cool features 😉

UglifyJS is written in Node.js which minifies JavaScript codes. Now we are taking this package to Sublime Text 🙂

Installing Minifying Tools to Sublime
Installing these to Sublime won’t only install UglifyJS but also other minifying tools which are:

But we are gonna need Package Control here in your Sublime Text, install it here. After installation, hold CTRL+SHIFT+P and type Install which will take you to Install Package, select and search for Minify then install it.

That was the part 1, here is another stage which needs node.js because those packages runs with node.js.

Installing to Linux
Firstly we are installing the npm

$ sudo apt-get install npm

Then install these packages after that

$ sudo npm install -g clean-css uglifycss js-beautify html-minifier uglify-js

When this is done, just open a JS file in your sublime and hold CTRL+ALT+M and you’ve got your minified JS file 😉

 

James John

Software Engineer