Fixes #264 - processing `@import` statements inside comments.
authorJakub Pawlowicz <jakub@goalsmashers.com>
Mon, 24 Mar 2014 20:31:39 +0000 (20:31 +0000)
committerJakub Pawlowicz <jakub@goalsmashers.com>
Mon, 24 Mar 2014 20:43:21 +0000 (20:43 +0000)
History.md
lib/imports/inliner.js
test/unit-test.js

index 359b6ff..595df31 100644 (file)
 * Fixed issue [#247](https://github.com/GoalSmashers/clean-css/issues/247) - removes deprecated `selectorsMergeMode` switch.
 * Refixed issue [#250](https://github.com/GoalSmashers/clean-css/issues/250) - based on new quotation marks removal.
 
+[2.1.7 / 2014-xx-xx (UNRELEASED)](https://github.com/GoalSmashers/clean-css/compare/v2.1.6...v2.1.7)
+==================
+
+* Fixed issue [#264](https://github.com/GoalSmashers/clean-css/issues/264) - `@import` statements inside comments.
+
 [2.1.6 / 2014-03-10](https://github.com/GoalSmashers/clean-css/compare/v2.1.5...v2.1.6)
 ==================
 
index 7f2c121..80723b5 100644 (file)
@@ -57,7 +57,7 @@ module.exports = function Inliner(context, options) {
         break;
       }
 
-      shared.done.push(data.substring(cursor, nextStart));
+      shared.done.push(data.substring(0, nextStart));
       shared.left.unshift([data.substring(nextEnd + 1), options]);
 
       return afterContent(nextStart) ?
index 1e70fd6..6fe1eeb 100644 (file)
@@ -1210,6 +1210,10 @@ title']{display:block}",
       '/* @import url(test/data/partials/five.css); */a { color: red; }',
       'a{color:red}'
     ],
+    'after a comment': [
+      '/* @import url(test/data/partials/one.css); */@import url(test/data/partials/one.css);a { color: red; }',
+      '.one,a{color:red}'
+    ],
     'used arbitrarily in comment': [
       '/* @import foo */a { color: red; }',
       'a{color:red}'