File tree Expand file tree Collapse file tree 4 files changed +31
-6
lines changed Expand file tree Collapse file tree 4 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -117,16 +117,20 @@ function run() {
117117 read ( input , function ( err , buffer ) {
118118 if ( err ) logger . throw ( err ) ;
119119 var css = buffer . toString ( ) ;
120+ var optsAliases = {
121+ importRoot : 'root'
122+ } ;
120123 var flags = [
121124 'minify' ,
122125 'encapsulate' ,
123- 'root ' ,
126+ 'importRoot ' ,
124127 'lint'
125- ] . reduce ( function ( accumulator , flag ) {
126- if ( ( { } ) . hasOwnProperty . call ( program , flag ) ) {
127- accumulator [ flag ] = program [ flag ] ;
128+ ] . reduce ( function ( acc , inFlag ) {
129+ if ( ( { } ) . hasOwnProperty . call ( program , inFlag ) ) {
130+ var flag = optsAliases [ inFlag ] || inFlag ;
131+ acc [ flag ] = program [ inFlag ] ;
128132 }
129- return accumulator ;
133+ return acc ;
130134 } , { } ) ;
131135 var opts = assign ( { } , config , flags ) ;
132136
Original file line number Diff line number Diff line change @@ -133,5 +133,20 @@ describe('cli', function() {
133133 done ( ) ;
134134 } ) ;
135135 } ) ;
136- } ) ;
137136
137+ describe ( '--importRoot' , function ( ) {
138+ it ( 'should be able to override root in a config file with importRoot' , function ( done ) {
139+ exec ( 'node bin/suitcss -c test/config/root-fake.js -i ./test/fixtures ./test/fixtures/import.css test/fixtures/cli/output.css' , function ( err ) {
140+ expect ( err ) . to . be . null ;
141+ done ( ) ;
142+ } ) ;
143+ } ) ;
144+
145+ it ( 'should use the config root option if importRoot is undefined' , function ( done ) {
146+ exec ( 'node bin/suitcss -c test/config/root-real.js ./test/fixtures/import.css test/fixtures/cli/output.css' , function ( err ) {
147+ expect ( err ) . to . be . null ;
148+ done ( ) ;
149+ } ) ;
150+ } ) ;
151+ } ) ;
152+ } ) ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ root : './foo/bar'
3+ } ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ root : './test/fixtures'
3+ } ;
You can’t perform that action at this time.
0 commit comments