Fixes #841 - disabled importing and many files passed as array.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Mon, 12 Dec 2016 12:57:06 +0000 (13:57 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Mon, 12 Dec 2016 15:05:59 +0000 (16:05 +0100)
Why:

* Importing via `@shallow` feature should be propagated to next
  files in the importing queue.

History.md
lib/imports/inliner.js
test/module-test.js

index c2211a2..d800bff 100644 (file)
@@ -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)
 ==================
 
index cca126b..041d733 100644 (file)
@@ -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);
   }
index 0cad3f6..7fac792 100644 (file)
@@ -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}');
+        }
       }
     }
   },