Created
May 31, 2014 08:00
-
-
Save breezhang/06307ad2d916b09b9052 to your computer and use it in GitHub Desktop.
uglifyjs compress js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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