JavaScript minification. It’s easy!

Minification is definitely not rocket science.

You just need a few simple tools…

  • cat or type – to concatenate files. (type for Windows users)
  • minifier – a js minifier (there are many, if you don’t fancy minifier)

Setting up the tools is easy…

  • cat / type - Nothing to do!
  • minifier – Simply Run:  npm install -g minifier 

      >>Don’t have npm!?!? It ships with Node.js. Get it here!<<

And using the tools is also easy…

Minify a single JS file:

minify --output myfile.min.js myfile.js

Minify multiple JS files into one?

cat file.js file2.js dir/file3.js dir/file4.js > myapp.js
minify --output myapp.min.js mayapp.js

Running Windows? Remember to replace cat with type.


You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Get every new post on this blog delivered to your Inbox.

Join other followers: