From: GoalSmashers Date: Wed, 18 Dec 2013 21:49:48 +0000 (+0100) Subject: Fixes #192 - many `@import`s inside a comment. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=7b739b65afe4c59bb8dbcf28ba8e368352da2fb8;p=clean-css.git Fixes #192 - many `@import`s inside a comment. * Broken comments scanner when more than one import inside a comment. --- diff --git a/History.md b/History.md index 2654a624..fd9a84e1 100644 --- a/History.md +++ b/History.md @@ -13,6 +13,7 @@ ================== * Fixed issue [#191](https://github.com/GoalSmashers/clean-css/issues/191) - leading numbers in font/animation names. +* Fixed issue [#192](https://github.com/GoalSmashers/clean-css/issues/192) - many `@import`s inside a comment. [2.0.2 / 2013-11-18](https://github.com/GoalSmashers/clean-css/compare/v2.0.1...v2.0.2) ================== diff --git a/lib/imports/inliner.js b/lib/imports/inliner.js index acd5d71c..e1e359a3 100644 --- a/lib/imports/inliner.js +++ b/lib/imports/inliner.js @@ -56,6 +56,10 @@ module.exports = function Inliner(context) { if (noComments) return false; + // idx can be still within last matched comment (many @import statements inside one comment) + if (idx < lastEndIndex) + return true; + comment = data.match(commentRegex); if (!comment) { diff --git a/test/data/issue-192-min.css b/test/data/issue-192-min.css new file mode 100644 index 00000000..14033f09 --- /dev/null +++ b/test/data/issue-192-min.css @@ -0,0 +1 @@ +.vrac{overflow:hidden;position:relative} diff --git a/test/data/issue-192.css b/test/data/issue-192.css new file mode 100644 index 00000000..75845399 --- /dev/null +++ b/test/data/issue-192.css @@ -0,0 +1,8 @@ +/* +@import url(//fonts.googleapis.com/css?family=PT+Sans+Caption:400italic,400,700italic,700); +@import url(//fonts.googleapis.com/css?family=Droid+Sans:400,700); +*/ +.vrac { + overflow: hidden; + position: relative +}