Fixes issue #113 - @import inside comment statement.
authorGoalSmashers <jakub@goalsmashers.com>
Tue, 11 Jun 2013 11:09:14 +0000 (13:09 +0200)
committerGoalSmashers <jakub@goalsmashers.com>
Tue, 11 Jun 2013 11:09:14 +0000 (13:09 +0200)
History.md
lib/clean.js
test/unit-test.js

index ca4f72c..3e5875f 100644 (file)
@@ -1,3 +1,8 @@
+1.0.9 / 2013-06-xx
+==================
+
+* Fixed issue [#113](https://github.com/GoalSmashers/clean-css/issues/113) - @import in comments.
+
 1.0.8 / 2013-06-10
 ==================
 
index eab9975..2af9486 100644 (file)
@@ -77,6 +77,11 @@ var CleanCSS = {
     // replace all escaped line breaks
     replace(/\\(\r\n|\n)/mg, '');
 
+    // strip comments one by one
+    replace(function stripComments() {
+      data = CleanCSS._stripComments(context, data);
+    });
+
     // inline all imports
     replace(function inlineImports() {
       data = CleanCSS._inlineImports(data, {
@@ -85,11 +90,6 @@ var CleanCSS = {
       });
     });
 
-    // strip comments one by one
-    replace(function stripComments() {
-      data = CleanCSS._stripComments(context, data);
-    });
-
     // strip parentheses in urls if possible (no spaces inside)
     replace(/url\((['"])([^\)]+)['"]\)/g, function(match, quote, url) {
       if (url.match(/[ \t]/g) !== null || url.indexOf('data:') === 0)
index 2505cf9..56e866a 100644 (file)
@@ -833,6 +833,10 @@ title']",
     'of a file with a resource URI': [
       "@import url(test/data/partials/five.css);",
       ".five{background:url(data:image/jpeg;base64,/9j/)}"
+    ],
+    'inside a comment': [
+      '/* @import */a { color: red; }',
+      'a{color:red}'
     ]
   }),
   '@import with absolute paths': cssContext({