Skip to content

Commit aa4c498

Browse files
committed
CLI flags override config file options
1 parent acd1c9c commit aa4c498

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### HEAD
22

3+
* CLI flags override config file options
34
* Input file is now linted (previously only imported files were passed through
45
the linting tools)
56
* Add `--throw-error` (`-e`) to CLI

bin/suitcss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ function run() {
109109
read(input, function(err, buffer) {
110110
if (err) logger.throw(err);
111111
var css = buffer.toString();
112-
var opts = assign({}, {
112+
var opts = assign({}, config, {
113113
minify: program.minify,
114114
root: program.importRoot,
115115
lint: program.lint
116-
}, config);
116+
});
117117

118118
if (program.throwError) {
119119
assign(opts, {

test/cli.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ describe('cli', function() {
8686
});
8787
});
8888

89+
it('should allow to override config options via cli flags', function(done) {
90+
exec('node bin/suitcss -L -c test/config/test.js test/fixtures/import.css test/fixtures/cli/output.css', function(err) {
91+
if (err) return done(err);
92+
var res = util.read('fixtures/cli/output');
93+
var commentsPattern = /\/\*[^]*?\*\//g;
94+
expect(res).to.match(commentsPattern);
95+
done();
96+
});
97+
});
98+
8999
it('should output an error to stderr on conformance failure when --throw-error is set', function(done) {
90100
exec('node bin/suitcss -i test/fixtures -e test/fixtures/import-error.css test/fixtures/cli/output.css', function(err, stdout, stderr) {
91101
expect(err).to.be.an('error');

test/config/test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
lint: true,
23
use: [
34
"postcss-property-lookup"
45
],

0 commit comments

Comments
 (0)