Here i am with new task where combining multiple file js into single js file and minify the js.
Steps i made,
But i have minified single js with below code:
var UglifyJS = require('uglify-js');
var fs = require('fs');
var result = UglifyJS.minify('site.js', {
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('site.min.js', result.code);
This working perfectly to me.
But ,
i have site1.js,site2.js and site3.js this should be converted into single minified file (eg.files.min.js)
Pass it an array of filenames
var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ]);