function minify(name) { var result = uglify.minify([DIST + '/' + name + '.js'], { outSourceMap: name + '.map', output: { comments: /@license/, max_line_len: 64000 // extra large because we have embedded code for workers } }); var fileMin = DIST + '/' + name + '.min.js'; var fileMap = DIST + '/' + name + '.map'; fs.writeFileSync(fileMin, result.code); fs.writeFileSync(fileMap, result.map); gutil.log('Minified ' + fileMin); gutil.log('Mapped ' + fileMap); }
gulp.task('minify', ['bundle'], function () { var oldCwd = process.cwd(); process.chdir(DIST); try { var result = uglify.minify([FILE], uglifyConfig); fs.writeFileSync(FILE_MIN, result.code); fs.writeFileSync(FILE_MAP, result.map); gutil.log('Minified ' + FILE_MIN); gutil.log('Mapped ' + FILE_MAP); } catch(e) { throw e; } finally { process.chdir(oldCwd); } });
function minify(name) { var result = uglify.minify([DIST + '/' + name + '.js'], { outSourceMap: name + '.map', output: { comments: /@license/, max_line_len: 64000 // extra large because we have embedded code for workers } }); var fileMin = DIST + '/' + name + '.min.js'; var fileMap = DIST + '/' + name + '.map'; fs.writeFileSync(fileMin, result.code); fs.writeFileSync(fileMap, result.map); gutil.log('Minified ' + fileMin); gutil.log('Mapped ' + fileMap); }