Allow keepSpecialComments to be set as a string
authorKyle Robinson Young <kyle@dontkry.com>
Wed, 23 Oct 2013 21:08:11 +0000 (14:08 -0700)
committerKyle Robinson Young <kyle@dontkry.com>
Wed, 23 Oct 2013 21:08:11 +0000 (14:08 -0700)
lib/text/comments.js
test/unit-test.js

index a1b6e43..7528b75 100644 (file)
@@ -45,10 +45,12 @@ module.exports = function Comments(keepSpecialComments, keepBreaks, lineBreak) {
           case '*':
             return comments.restore(placeholder) + breakSuffix;
           case 1:
+          case '1':
             return restored == 1 ?
               comments.restore(placeholder) + breakSuffix :
               '';
           case 0:
+          case '0':
             return '';
         }
       });
index 32d7291..64c8743 100644 (file)
@@ -273,6 +273,12 @@ vows.describe('clean-units').addBatch({
       "@charset 'utf-8';a{}"
     ]
   }, { keepSpecialComments: 0 }),
+  'important comments - keepSpecialComments when a string': cssContext({
+    'strip all': [
+      '/*! important comment */a{color:red}/* some comment *//*! important comment */',
+      'a{color:red}'
+    ]
+  }, { keepSpecialComments: '0' }),
   'expressions': cssContext({
     'empty': 'a{color:expression()}',
     'method call': 'a{color:expression(this.parentNode.currentStyle.color)}',