Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions bin/suitcss
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,20 @@ function run() {
read(input, function(err, buffer) {
if (err) logger.throw(err);
var css = buffer.toString();
var optsAliases = {
importRoot: 'root'
};
var flags = [
'minify',
'encapsulate',
'root',
'importRoot',
'lint'
].reduce(function (accumulator, flag) {
if (({}).hasOwnProperty.call(program, flag)) {
accumulator[flag] = program[flag];
].reduce(function(acc, inFlag) {
if (({}).hasOwnProperty.call(program, inFlag)) {
var flag = optsAliases[inFlag] || inFlag;
acc[flag] = program[inFlag];
}
return accumulator;
return acc;
}, {});
var opts = assign({}, config, flags);

Expand Down
17 changes: 16 additions & 1 deletion test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,20 @@ describe('cli', function() {
done();
});
});
});

describe('--importRoot', function() {
it('should be able to override root in a config file with importRoot', function(done) {
exec('node bin/suitcss -c test/config/root-fake.js -i ./test/fixtures ./test/fixtures/import.css test/fixtures/cli/output.css', function(err) {
expect(err).to.be.null;
done();
});
});

it('should use the config root option if importRoot is undefined', function(done) {
exec('node bin/suitcss -c test/config/root-real.js ./test/fixtures/import.css test/fixtures/cli/output.css', function(err) {
expect(err).to.be.null;
done();
});
});
});
});
3 changes: 3 additions & 0 deletions test/config/root-fake.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
root: './foo/bar'
};
3 changes: 3 additions & 0 deletions test/config/root-real.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
root: './test/fixtures'
};