File tree 4 files changed +31
-6
lines changed
4 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -117,16 +117,20 @@ function run() {
117
117
read ( input , function ( err , buffer ) {
118
118
if ( err ) logger . throw ( err ) ;
119
119
var css = buffer . toString ( ) ;
120
+ var optsAliases = {
121
+ importRoot : 'root'
122
+ } ;
120
123
var flags = [
121
124
'minify' ,
122
125
'encapsulate' ,
123
- 'root ' ,
126
+ 'importRoot ' ,
124
127
'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 ] ;
128
132
}
129
- return accumulator ;
133
+ return acc ;
130
134
} , { } ) ;
131
135
var opts = assign ( { } , config , flags ) ;
132
136
Original file line number Diff line number Diff line change @@ -133,5 +133,20 @@ describe('cli', function() {
133
133
done ( ) ;
134
134
} ) ;
135
135
} ) ;
136
- } ) ;
137
136
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