How to get minified output with browserify?

Fdr picture Fdr · Mar 23, 2013 · Viewed 52.2k times · Source

Just started to use browserify, but I cannot find documentation for how to get it spilling out minified output.

So I am looking something like:

$> browserify main.js > bundle.js --minified

Answer

topek picture topek · Mar 23, 2013

Pipe it through uglifyjs:

 browserify main.js | uglifyjs > bundle.js

You can install it using npm like so:

 npm install -g uglify-js