Repository: suitcss/preprocessor (js)
Issue: CLI options should override config file
Currently I think CLI options are overridden by the config file:

``` js
var opts = assign({}, {
      minify: program.minify,
      root: program.importRoot,
      lint: program.lint
    }, config);
```

AFAIK it's most common to be the other way round as it's often useful to be able to override a single config option on the CLI.

Should be a simple change and maybe a test to verify.

Pull request description: Fix undefined cli flags override config
When cli flags are not passed their value is `undefined` and they override the config file options.
This branch fixes this behaviour.

Fixes #54 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ee47e1..b263a74 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 ### HEAD
 
+### 3.0.1 (November XX, 2016)
+
+* Fix: `undefined` cli flags don't override config
+
 ### 3.0.0 (October 20, 2016)
 
 * Pin core plugins order:
diff --git a/bin/suitcss b/bin/suitcss
index f3ceaf6..85c4be1 100755
--- a/bin/suitcss
+++ b/bin/suitcss
@@ -110,12 +110,18 @@ function run() {
   read(input, function(err, buffer) {
     if (err) logger.throw(err);
     var css = buffer.toString();
-    var opts = assign({}, config, {
-      minify: program.minify,
-      root: program.importRoot,
-      encapsulate: program.encapsulate,
-      lint: program.lint
-    });
+    var flags = [
+      'minify',
+      'encapsulate',
+      'root',
+      'lint'
+    ].reduce(function (accumulator, flag) {
+      if (({}).hasOwnProperty.call(program, flag)) {
+        accumulator[flag] = program[flag];
+      }
+      return accumulator;
+    }, {});
+    var opts = assign({}, config, flags);
 
     if (program.throwError) {
       assign(opts, {


Test patch:
diff --git a/test/cli.js b/test/cli.js
index b57ebd8..29aea4b 100644
--- a/test/cli.js
+++ b/test/cli.js
@@ -87,11 +87,21 @@ describe('cli', function() {
   });
 
   it('should allow to override config options via cli flags', function(done) {
-    exec('node bin/suitcss -L -c test/config/test.js test/fixtures/import.css test/fixtures/cli/output.css', function(err) {
+    exec('node bin/suitcss -m -c test/config/test.js test/fixtures/import.css test/fixtures/cli/output.css', function(err) {
       if (err) return done(err);
       var res = util.read('fixtures/cli/output');
       var commentsPattern = /\/\*[^]*?\*\//g;
-      expect(res).to.match(commentsPattern);
+      expect(res).to.not.match(commentsPattern);
+      done();
+    });
+  });
+
+  it('should preserve config options when not passing cli flags', function(done) {
+    exec('node bin/suitcss -c test/config/cli-undefined-flags.js test/fixtures/import.css test/fixtures/cli/output.css', function(err) {
+      if (err) return done(err);
+      var res = util.read('fixtures/cli/output');
+      var commentsPattern = /\/\*[^]*?\*\//g;
+      expect(res).to.not.match(commentsPattern);
       done();
     });
   });
diff --git a/test/config/cli-undefined-flags.js b/test/config/cli-undefined-flags.js
new file mode 100644
index 0000000..8dfc5cc
--- /dev/null
+++ b/test/config/cli-undefined-flags.js
@@ -0,0 +1,3 @@
+module.exports = {
+  minify: true
+};
diff --git a/test/config/test.js b/test/config/test.js
index 63713ad..04c8943 100644
--- a/test/config/test.js
+++ b/test/config/test.js
@@ -1,5 +1,6 @@
 module.exports = {
   lint: true,
+  minify: false,
   use: [
     'postcss-property-lookup'
   ],