@@ -3,6 +3,7 @@ var path = require('path');
33
44var CleanCSS = require ( 'clean-css' ) ;
55var commands = require ( 'commander' ) ;
6+ var glob = require ( 'glob' ) ;
67
78function cli ( process , beforeMinifyCallback ) {
89 var packageConfig = fs . readFileSync ( path . join ( __dirname , 'package.json' ) ) ;
@@ -155,7 +156,7 @@ function cli(process, beforeMinifyCallback) {
155156
156157 // ... and do the magic!
157158 if ( commands . args . length > 0 ) {
158- minify ( process , beforeMinifyCallback , options , debugMode , commands . args ) ;
159+ minify ( process , beforeMinifyCallback , options , debugMode , expandGlobs ( commands . args ) ) ;
159160 } else {
160161 stdin = process . openStdin ( ) ;
161162 stdin . setEncoding ( 'utf-8' ) ;
@@ -197,6 +198,12 @@ function findArgumentTo(option, rawArgs, args) {
197198 return value ;
198199}
199200
201+ function expandGlobs ( paths ) {
202+ return paths . reduce ( function ( accumulator , path ) {
203+ return accumulator . concat ( glob . sync ( path , { nodir : true , nonull : true } ) ) ;
204+ } , [ ] ) ;
205+ }
206+
200207function minify ( process , beforeMinifyCallback , options , debugMode , data ) {
201208 var cleanCss = new CleanCSS ( options ) ;
202209
0 commit comments