From 1d27287276210a1e1830136cb80ad7da75418a71 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Mon, 12 Dec 2016 13:57:06 +0100 Subject: [PATCH] Fixes #841 - disabled importing and many files passed as array. Why: * Importing via `@shallow` feature should be propagated to next files in the importing queue. --- History.md | 5 +++++ lib/imports/inliner.js | 2 +- test/module-test.js | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index c2211a2b..d800bff3 100644 --- a/History.md +++ b/History.md @@ -3,6 +3,11 @@ * Requires Node.js 4.0+ to run. +[3.4.22 / 2016-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.21...v3.4) +================== + +* Fixed issue [#841](https://github.com/jakubpawlowicz/clean-css/issues/841) - disabled importing and files passed as array. + [3.4.21 / 2016-11-16](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.20...v3.4.21) ================== diff --git a/lib/imports/inliner.js b/lib/imports/inliner.js index cca126b5..041d7335 100644 --- a/lib/imports/inliner.js +++ b/lib/imports/inliner.js @@ -69,7 +69,7 @@ function importFrom(data, context) { var noImportPart = data.substring(0, nextStart); context.done.push(noImportPart); - context.left.unshift([data.substring(nextEnd + 1), context]); + context.left.unshift([data.substring(nextEnd + 1), override(context, { shallow: false })]); context.afterContent = hasContent(noImportPart); return inline(data, nextStart, nextEnd, context); } diff --git a/test/module-test.js b/test/module-test.js index 0cad3f6b..7fac792a 100644 --- a/test/module-test.js +++ b/test/module-test.js @@ -467,13 +467,21 @@ vows.describe('module tests').addBatch({ } }, 'with imports': { - 'off': { + 'off - one file': { 'topic': function () { return new CleanCSS({ processImport: false }).minify(['./test/fixtures/partials/two.css']); }, 'should give right output': function (minified) { assert.equal(minified.styles, '@import url(one.css);@import url(extra/three.css);@import url(./extra/four.css);.two{color:#fff}'); } + }, + 'off - many files': { + 'topic': function () { + return new CleanCSS({ processImport: false }).minify(['./test/fixtures/partials/remote.css', './test/fixtures/partials-absolute/base.css']); + }, + 'should give right output': function (minified) { + assert.equal(minified.styles, '@import url(http://jakubpawlowicz.com/styles.css);@import url(./extra/sub.css);.base{margin:0}'); + } } } }, -- 2.34.1