Update build scripts.

This commit is contained in:
John-David Dalton
2015-10-22 21:06:08 -07:00
parent 99287a89eb
commit ac16bc0e15
5 changed files with 77 additions and 31 deletions

23
lib/common/minify.js Normal file
View File

@@ -0,0 +1,23 @@
'use strict';
var _ = require('lodash'),
fs = require('fs-extra'),
uglify = require('uglify-js');
var uglifyOptions = require('./uglify.options.js');
/*----------------------------------------------------------------------------*/
function minify(inpath, outpath, callback, options) {
if (typeof outpath == 'function') {
outpath = undefined;
callback = options;
}
if (!outpath) {
outpath = inpath.replace(/(?=\.js$)/, '.min');
}
var output = uglify.minify(inpath, _.defaults(options, uglifyOptions));
fs.writeFile(outpath, output.code, 'utf-8', callback);
}
module.exports = minify;

View File

@@ -0,0 +1,16 @@
module.exports = {
'mangle': true,
'compress': {
'comparisons': false,
'keep_fargs': true,
'pure_getters': true,
'unsafe': true,
'unsafe_comps': true,
'warnings': false
},
'output': {
'ascii_only': true,
'beautify': false,
'max_line_len': 500
}
};