From: Jakub Pawlowicz Date: Mon, 10 Feb 2014 21:29:15 +0000 (+0000) Subject: Fixes #236 - incorrect rebasing with nested `import`s. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=785567a66553972de5546f0a13bfa15971d74fc3;p=clean-css.git Fixes #236 - incorrect rebasing with nested `import`s. Because of a typo, rebasing of nested relative imports were not processed correctly, leading to relative paths to last @import not the original one. Thanks to @alexeyraspopov for spotting it! --- diff --git a/History.md b/History.md index 5f783c63..3aa02c6f 100644 --- a/History.md +++ b/History.md @@ -21,6 +21,7 @@ * Fixed issue [#226](https://github.com/GoalSmashers/clean-css/issues/226) - don't minify border:none to border:0. * Fixed issue [#229](https://github.com/GoalSmashers/clean-css/issues/229) - improved processing of fraction numbers. * Fixed issue [#230](https://github.com/GoalSmashers/clean-css/issues/230) - better handling of zero values. +* Fixed issue [#236](https://github.com/GoalSmashers/clean-css/issues/236) - incorrect rebasing with nested `import`s. [2.0.8 / 2014-02-07](https://github.com/GoalSmashers/clean-css/compare/v2.0.7...v2.0.8) ================== diff --git a/lib/imports/inliner.js b/lib/imports/inliner.js index 2b9d5f0d..7f2c1219 100644 --- a/lib/imports/inliner.js +++ b/lib/imports/inliner.js @@ -290,7 +290,7 @@ module.exports = function Inliner(context, options) { return process(importedData, { root: options.root, relativeTo: importRelativeTo, - _baseRelativeTo: options.baseRelativeTo, + _baseRelativeTo: options._baseRelativeTo, _shared: options._shared, visited: options.visited, whenDone: options.whenDone, diff --git a/test/data/partials-relative/extra/included.css b/test/data/partials-relative/extra/included.css new file mode 100644 index 00000000..283636f3 --- /dev/null +++ b/test/data/partials-relative/extra/included.css @@ -0,0 +1 @@ +@import '../base.css'; diff --git a/test/unit-test.js b/test/unit-test.js index 0d778e05..3054c242 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -814,6 +814,10 @@ path")}', '@import url(test/data/partials-relative/base.css);', 'a{background:url(test/data/partials/extra/down.gif) 0 0 no-repeat}' ], + 'relative @import twice': [ + '@import url(test/data/partials-relative/extra/included.css);', + 'a{background:url(test/data/partials/extra/down.gif) 0 0 no-repeat}' + ], 'absolute @import': [ '@import url(/test/data/partials-relative/base.css);', 'a{background:url(test/data/partials/extra/down.gif) 0 0 no-repeat}'