Skip to content

Instantly share code, notes, and snippets.

@breezhang
Created May 31, 2014 08:00
Show Gist options
  • Save breezhang/06307ad2d916b09b9052 to your computer and use it in GitHub Desktop.
Save breezhang/06307ad2d916b09b9052 to your computer and use it in GitHub Desktop.
uglifyjs compress js
var UglifyJS = require('C:/d1/a/node_modules/uglify-js/tools/node.js');
var fs = require('fs');
var i,o ;
i = process.argv[2];
o = process.argv[3];
var result = UglifyJS.minify(i, {
mangle: true,
compress: {
sequences: true,
dead_code: true,
conditionals: true,
booleans: true,
unused: true,
if_return: true,
join_vars: true,
drop_console: true
}
});
fs.writeFileSync(o, result.code);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment