From: Jakub Pawlowicz Date: Mon, 24 Mar 2014 20:31:39 +0000 (+0000) Subject: Fixes #264 - processing `@import` statements inside comments. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f7a4a70851253a39c44586f01c63e1d5dfe0f026;p=clean-css.git Fixes #264 - processing `@import` statements inside comments. --- diff --git a/History.md b/History.md index 359b6ff7..595df310 100644 --- a/History.md +++ b/History.md @@ -13,6 +13,11 @@ * 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) ================== diff --git a/lib/imports/inliner.js b/lib/imports/inliner.js index 7f2c1219..80723b55 100644 --- a/lib/imports/inliner.js +++ b/lib/imports/inliner.js @@ -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) ? diff --git a/test/unit-test.js b/test/unit-test.js index 1e70fd62..6fe1eeb9 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -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}'