Add option -s --skip-import
authorabarre <a@fasterize.com>
Fri, 19 Jul 2013 12:34:15 +0000 (14:34 +0200)
committerabarre <a@fasterize.com>
Fri, 19 Jul 2013 12:34:15 +0000 (14:34 +0200)
bin/cleancss
test/binary-test.js

index 5c34c0b..ba8df43 100755 (executable)
@@ -21,7 +21,8 @@ commands
   .option('--s0', 'Remove all special comments (i.e. /*! special comment */)')
   .option('--s1', 'Remove all special comments but the first one')
   .option('-r, --root [root-path]', 'Set a root path to which resolve absolute @import rules')
-  .option('-o, --output [output-file]', 'Use [output-file] as output instead of stdout');
+  .option('-o, --output [output-file]', 'Use [output-file] as output instead of stdout')
+  .option('-s, --skip-import', 'Disable the @import processing');
 
 commands.on('--help', function() {
   util.puts('  Examples:\n');
@@ -65,6 +66,8 @@ if (commands.s0)
   cleanOptions.keepSpecialComments = 0;
 if (commands.root)
   cleanOptions.root = commands.root;
+if (commands.skipImport)
+  cleanOptions.processImport = false;
 if (commands.args.length > 0) {
   var source = commands.args[0];
   options.source = source;
index 0684aa3..ca965c7 100644 (file)
@@ -109,5 +109,10 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({
       else
         exec('rm ./reset-min.css');
     }
+  }),
+  'disable @import': binaryContext('-s ./test/data/imports.css', {
+    'should disable the import processing': function(error, stdout) {
+      assert.equal(stdout, "@import url(./partials/one.css);@import url(./partials/two.css);.imports{color:#000}");
+    }
   })
 });