diff --git a/cli.js b/cli.js index 2d0a9b30..ac2f5bca 100755 --- a/cli.js +++ b/cli.js @@ -189,7 +189,7 @@ program.option('-c --config-file ', 'Use config file', function(configPath }); program.option('--input-dir ', 'Specify an input directory'); program.option('--output-dir ', 'Specify an output directory'); -program.option('--file-ext ', 'Specify an extension to be read, ex: html'); +program.option('--file-ext ', 'Specify extensions to be read, separated by commas, ex: html,htm,xml'); var content; program.arguments('[files...]').action(function(files) { content = files.map(readFile).join(''); @@ -262,7 +262,7 @@ function processDirectory(inputDir, outputDir, fileExt) { else if (stat.isDirectory()) { processDirectory(inputFile, outputFile, fileExt); } - else if (!fileExt || path.extname(file) === '.' + fileExt) { + else if (!fileExt || ~fileExt.indexOf(path.extname(file).slice(1))) { mkdir(outputDir, function() { processFile(inputFile, outputFile); }); @@ -295,6 +295,9 @@ if (inputDir || outputDir) { else if (!outputDir) { fatal('You need to specify where to write the output files with the option --output-dir'); } + if (fileExt) { + fileExt = fileExt.split(','); + } processDirectory(inputDir, outputDir, fileExt); } // Minifying one or more files specified on the CMD line