Update uglifyjs
Revised the input parameters to allow for the JS source to be folders of JS files as well as just JS files.
This commit is contained in:
parent
5c4cfaa0a7
commit
38bf218e7e
17
bin/uglifyjs
17
bin/uglifyjs
|
|
@ -254,7 +254,22 @@ if (ARGS.comments != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var files = ARGS._.slice();
|
var files = (function expand_folder_of_JS_files( arrFiles) {
|
||||||
|
var arrJS_files = [];
|
||||||
|
arrFiles.forEach( function(filename) {
|
||||||
|
var fsStats = fs.statSync(filename);
|
||||||
|
if (fsStats.isFile() && filename.match(/.js$/i)) { arrJS_files.push(filename);}
|
||||||
|
else if (fsStats.isDirectory()) {
|
||||||
|
var strFolder = fs.realpathSync(filename)+ "/";
|
||||||
|
var arrDir = fs.readdirSync(strFolder,'utf8');
|
||||||
|
arrDir.forEach( function(dirFile) {
|
||||||
|
var arrFile = expand_folder_of_JS_files( [strFolder+ dirFile]);
|
||||||
|
if (arrFile && arrFile.length) { arrJS_files.push(arrFile[0]);}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return arrJS_files;
|
||||||
|
})(ARGS._.slice());
|
||||||
|
|
||||||
if (ARGS.self) {
|
if (ARGS.self) {
|
||||||
if (files.length > 0) {
|
if (files.length > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user