Fixes #236 - incorrect rebasing with nested `import`s.
authorJakub Pawlowicz <jakub@goalsmashers.com>
Mon, 10 Feb 2014 21:29:15 +0000 (21:29 +0000)
committerJakub Pawlowicz <jakub@goalsmashers.com>
Mon, 10 Feb 2014 21:30:38 +0000 (21:30 +0000)
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!

History.md
lib/imports/inliner.js
test/data/partials-relative/extra/included.css [new file with mode: 0644]
test/unit-test.js

index 5f783c6..3aa02c6 100644 (file)
@@ -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)
 ==================
index 2b9d5f0..7f2c121 100644 (file)
@@ -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 (file)
index 0000000..283636f
--- /dev/null
@@ -0,0 +1 @@
+@import '../base.css';
index 0d778e0..3054c24 100644 (file)
@@ -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}'