Repository: tivac/modular-css
Pull request #349 (2017-07-04 23:34:20)

fix: compatibility issues with cssnano4
**References**:
https://github.com/ben-eb/cssnano/pull/382
Fixes #348
Fixes #346

Rolling it all up, changes a lot of snapshots but nothing meaningful. Getting nice output in `postcss@6` seems weirdly difficult, so choosing to ignore that for now.

CC @darthmaim


Patch:
diff --git a/packages/core/package.json b/packages/core/package.json
index e4f948c5..7e99964e 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -20,6 +20,7 @@
     "postcss"
   ],
   "devDependencies": {
+    "cssnano": "^4.0.0-rc.1",
     "pegjs": "^0.10.0",
     "test-utils": "^5.1.5"
   },
diff --git a/packages/core/processor.js b/packages/core/processor.js
index 9cca9b0a..2f9eeb6a 100644
--- a/packages/core/processor.js
+++ b/packages/core/processor.js
@@ -225,7 +225,11 @@ Processor.prototype = {
             ))
         )
         .then((results) => {
-            var root = postcss.root();
+            // Clone the first result if available to get valid source information
+            var root = results.length ? results[0].root.clone() : postcss.root();
+
+            // Then destroy all its children before adding new ones
+            root.removeAll();
 
             results.forEach((result) => {
                 // Add file path comment
@@ -246,12 +250,9 @@ Processor.prototype = {
                         )
                     }),
                     idx;
-                
-                root.append([
-                    comment,
-                    result.root
-                ]);
 
+                root.append([ comment ].concat(result.root.nodes));
+                
                 idx = root.index(comment);
                 
                 // Need to manually insert a newline after the comment, but can only


Test patch:
diff --git a/packages/browserify/test/__snapshots__/browserify.test.js.snap b/packages/browserify/test/__snapshots__/browserify.test.js.snap
index 20fde66b..8964db4d 100644
--- a/packages/browserify/test/__snapshots__/browserify.test.js.snap
+++ b/packages/browserify/test/__snapshots__/browserify.test.js.snap
@@ -36,10 +36,8 @@ module.exports = {
 exports[`/browserify.js basic functionality should include all CSS dependencies in output css 2`] = `
 "/* packages/browserify/test/specimens/folder/folder.css */
 .mcd19f1319_folder { margin: 2px; }
-
 /* packages/browserify/test/specimens/local.css */
 .mcc4e2a8e1_booga { background: green; }
-
 /* packages/browserify/test/specimens/start.css */
 .mc1c78395f_booga { color: red; background: blue; }
 .mc1c78395f_tooga { border: 1px solid white; }
@@ -71,10 +69,8 @@ module.exports = {
 exports[`/browserify.js basic functionality should not include duplicate files in the output multiple times 2`] = `
 "/* packages/browserify/test/specimens/folder/folder.css */
 .mcd19f1319_folder { margin: 2px; }
-
 /* packages/browserify/test/specimens/local.css */
 .mcc4e2a8e1_booga { background: green; }
-
 /* packages/browserify/test/specimens/start.css */
 .mc1c78395f_booga { color: red; background: blue; }
 .mc1c78395f_tooga { border: 1px solid white; }
@@ -84,15 +80,13 @@ exports[`/browserify.js basic functionality should not include duplicate files i
 exports[`/browserify.js basic functionality should output an inline source map when the debug option is specified 1`] = `
 "/* packages/browserify/test/specimens/folder/folder.css */
 .mcd19f1319_folder { margin: 2px; }
-
 /* packages/browserify/test/specimens/local.css */
 .mcc4e2a8e1_booga { background: green; }
-
 /* packages/browserify/test/specimens/start.css */
 .mc1c78395f_booga { color: red; background: blue; }
 .mc1c78395f_tooga { border: 1px solid white; }
 
-/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NwZWNpbWVucy9mb2xkZXIvZm9sZGVyLmNzcyIsIi4uLy4uL3NwZWNpbWVucy9sb2NhbC5jc3MiLCIuLi8uLi9zcGVjaW1lbnMvc3RhcnQuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBEQUFDO0FBQ0QscUJBQVUsWUFBWSxFQUFFOztBQ0R4QixrREFBQztBQUlELG9CQUFTLGtCQUFrQixFQUFFOztBQ0o3QixrREFBQztBQUVELG9CREZBLFdBQWdCLENBQ2hCLGlCQUFpQixFQ0NzQjtBQUN2QyxvQkZIQSx3QkFBcUIsRUVHZSIsImZpbGUiOiJzb3VyY2UtbWFwcy5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyJAdmFsdWUgZm9sZGVyOiB3aGl0ZTtcbi5mb2xkZXIgeyBtYXJnaW46IDJweDsgfV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ZvbGRlci9mb2xkZXIuY3NzXCI7XG5cbi5ib29nYSB7IGJhY2tncm91bmQ6IGdyZWVuOyB9XG4ubG9vZ2EgeyBjb21wb3NlczogYm9vZ2E7IH1cbiIsIkB2YWx1ZSBvbmUsIHR3bywgZm9sZGVyIGZyb20gXCIuL2xvY2FsLmNzc1wiO1xuLndvb2dhIHsgY29tcG9zZXM6IGJvb2dhIGZyb20gXCIuL2xvY2FsLmNzc1wiOyB9XG4uYm9vZ2EgeyBjb2xvcjogb25lOyBiYWNrZ3JvdW5kOiB0d287IH1cbi50b29nYSB7IGJvcmRlcjogMXB4IHNvbGlkIGZvbGRlcjsgfVxuIl19 */"
 `;
 
 exports[`/browserify.js basic functionality should replace require() calls with the exported identifiers 1`] = `
diff --git a/packages/browserify/test/__snapshots__/factor-bundle.test.js.snap b/packages/browserify/test/__snapshots__/factor-bundle.test.js.snap
index d8b82889..66921b53 100644
--- a/packages/browserify/test/__snapshots__/factor-bundle.test.js.snap
+++ b/packages/browserify/test/__snapshots__/factor-bundle.test.js.snap
@@ -9,7 +9,6 @@ exports[`/browserify.js factor-bundle should avoid outputting empty css files by
 exports[`/browserify.js factor-bundle should avoid outputting empty css files by default 2`] = `
 "/* packages/browserify/test/specimens/local.css */
 .mcc4e2a8e1_booga { background: green; }
-
 /* packages/browserify/test/specimens/start.css */
 .mc1c78395f_booga { color: red; background: blue; }
 .mc1c78395f_tooga { border: 1px solid white; }
@@ -36,7 +35,6 @@ module.exports = {
 exports[`/browserify.js factor-bundle should be supported 2`] = `
 "/* packages/browserify/test/specimens/folder/folder.css */
 .mcd19f1319_folder { margin: 2px; }
-
 /* packages/browserify/test/specimens/local.css */
 .mcc4e2a8e1_booga { background: green; }
 "
@@ -58,7 +56,6 @@ exports[`/browserify.js factor-bundle should output empty css files when asked 1
 exports[`/browserify.js factor-bundle should output empty css files when asked 2`] = `
 "/* packages/browserify/test/specimens/local.css */
 .mcc4e2a8e1_booga { background: green; }
-
 /* packages/browserify/test/specimens/start.css */
 .mc1c78395f_booga { color: red; background: blue; }
 .mc1c78395f_tooga { border: 1px solid white; }
@@ -70,7 +67,6 @@ exports[`/browserify.js factor-bundle should output empty css files when asked 3
 exports[`/browserify.js factor-bundle should properly handle files w/o dependencies 1`] = `
 "/* packages/browserify/test/specimens/folder/folder.css */
 .mcd19f1319_folder { margin: 2px; }
-
 /* packages/browserify/test/specimens/local.css */
 .mcc4e2a8e1_booga { background: green; }
 "
@@ -97,7 +93,6 @@ exports[`/browserify.js factor-bundle should support files w/o commonalities 2`]
 exports[`/browserify.js factor-bundle should support relative paths within factor-bundle files 1`] = `
 "/* packages/browserify/test/specimens/folder/folder.css */
 .mcd19f1319_folder { margin: 2px; }
-
 /* packages/browserify/test/specimens/local.css */
 .mcc4e2a8e1_booga { background: green; }
 "
@@ -109,7 +104,6 @@ exports[`/browserify.js factor-bundle should support relative paths within facto
     color: red;
     background: url(\\"../../../specimens/folder/to.png\\");
 }
-
 /* packages/browserify/test/specimens/start.css */
 .mc1c78395f_booga { color: red; background: blue; }
 .mc1c78395f_tooga { border: 1px solid white; }
diff --git a/packages/browserify/test/__snapshots__/issue-313.test.js.snap b/packages/browserify/test/__snapshots__/issue-313.test.js.snap
index 16350813..74e62707 100644
--- a/packages/browserify/test/__snapshots__/issue-313.test.js.snap
+++ b/packages/browserify/test/__snapshots__/issue-313.test.js.snap
@@ -3,7 +3,6 @@
 exports[`/browserify.js /issues /313 should include all dependencies after watchify update 1`] = `
 "/* packages/browserify/test/specimens/issues/313/1.css */
 .mcd2dffd93_wooga { color: red; }
-
 /* packages/browserify/test/specimens/issues/313/2.css */
 .mc4882c370_fooga { color: blue; }
 "
diff --git a/packages/browserify/test/__snapshots__/issue-58.test.js.snap b/packages/browserify/test/__snapshots__/issue-58.test.js.snap
index e903c6f1..f0760690 100644
--- a/packages/browserify/test/__snapshots__/issue-58.test.js.snap
+++ b/packages/browserify/test/__snapshots__/issue-58.test.js.snap
@@ -35,12 +35,10 @@ exports[`/browserify.js /issues /58 should update when CSS dependencies change 3
 .mc2652cf16_other1 { color: green; }
 .mc2652cf16_other2 { color: yellow; }
 .mc2652cf16_other3 { background: white; }
-
 /* packages/browserify/test/specimens/issues/58/issue.css */
 .mc46e4a65d_issue1 {
     color: teal;
 }
-
 .mc46e4a65d_issue2 {
     color: aqua;
 }
diff --git a/packages/browserify/test/__snapshots__/watchify.test.js.snap b/packages/browserify/test/__snapshots__/watchify.test.js.snap
index ebfb65e7..c0889c7f 100644
--- a/packages/browserify/test/__snapshots__/watchify.test.js.snap
+++ b/packages/browserify/test/__snapshots__/watchify.test.js.snap
@@ -18,7 +18,6 @@ exports[`/browserify.js watchify caching shouldn't cache file contents between w
     color: red;
     background: url(\\"../../specimens/folder/to.png\\");
 }
-
 /* packages/browserify/test/specimens/watchify/relative.css */
 .mcf6f923e6_booga {
     background: url(\\"../../specimens/watchify/to.png\\");
@@ -32,7 +31,6 @@ exports[`/browserify.js watchify caching shouldn't cache file contents between w
     color: red;
     background: url(\\"../../specimens/folder/to.png\\");
 }
-
 /* packages/browserify/test/specimens/watchify/relative.css */
 .mcf6f923e6_booga {
     background: url(\\"../../specimens/watchify/to.png\\");
diff --git a/packages/core/test/__snapshots__/api.test.js.snap b/packages/core/test/__snapshots__/api.test.js.snap
index bb01724c..cdfdeeee 100644
--- a/packages/core/test/__snapshots__/api.test.js.snap
+++ b/packages/core/test/__snapshots__/api.test.js.snap
@@ -82,10 +82,8 @@ exports[`/processor.js API .file() should process an absolute file 4`] = `
 exports[`/processor.js API .output() should avoid duplicating files in the output 1`] = `
 "/* packages/core/test/specimens/folder/folder.css */
 .folder { margin: 2px; }
-
 /* packages/core/test/specimens/local.css */
 .booga { background: green; }
-
 /* packages/core/test/specimens/start.css */
 .booga { color: red; background: blue; }
 .tooga { border: 1px solid white; }
@@ -112,13 +110,10 @@ Object {
 exports[`/processor.js API .output() should generate css representing the output from all added files 1`] = `
 "/* packages/core/test/specimens/folder/folder.css */
 .folder { margin: 2px; }
-
 /* packages/core/test/specimens/simple.css */
 .wooga { color: red; }
-
 /* packages/core/test/specimens/local.css */
 .booga { background: green; }
-
 /* packages/core/test/specimens/start.css */
 .booga { color: red; background: blue; }
 .tooga { border: 1px solid white; }
@@ -128,25 +123,18 @@ exports[`/processor.js API .output() should generate css representing the output
 exports[`/processor.js API .output() should order output by dependencies, then alphabetically 1`] = `
 "/* packages/core/test/specimens/folder/folder.css */
 .folder { margin: 2px; }
-
 /* packages/core/test/specimens/folder/folder2.css */
 .folder2 { color: green; }
-
 /* packages/core/test/specimens/folder/subfolder/subfolder.css */
 .subfolder { color: yellow; }
-
 /* packages/core/test/specimens/composes.css */
-
-
 /* packages/core/test/specimens/deep.css */
 .deep {
     
     color: black;
 }
-
 /* packages/core/test/specimens/local.css */
 .booga { background: green; }
-
 /* packages/core/test/specimens/start.css */
 .booga { color: red; background: blue; }
 .tooga { border: 1px solid white; }
@@ -158,10 +146,8 @@ exports[`/processor.js API .output() should reject if called before input has be
 exports[`/processor.js API .output() should return a postcss result 1`] = `
 "/* packages/core/test/specimens/folder/folder.css */
 .folder { margin: 2px; }
-
 /* packages/core/test/specimens/local.css */
 .booga { background: green; }
-
 /* packages/core/test/specimens/start.css */
 .booga { color: red; background: blue; }
 .tooga { border: 1px solid white; }
diff --git a/packages/core/test/__snapshots__/externals.test.js.snap b/packages/core/test/__snapshots__/externals.test.js.snap
index 354c012f..5ceadda8 100644
--- a/packages/core/test/__snapshots__/externals.test.js.snap
+++ b/packages/core/test/__snapshots__/externals.test.js.snap
@@ -3,18 +3,14 @@
 exports[`/processor.js externals should support overriding external values 1`] = `
 "/* packages/core/test/specimens/folder/folder.css */
 .folder { margin: 2px; }
-
 /* packages/core/test/specimens/simple.css */
 .wooga { color: red; }
-
 /* packages/core/test/specimens/local.css */
 .booga { background: green; }
-
 /* packages/core/test/specimens/externals.css */
 .a .wooga {
     color: green;
 }
-
 .b:hover .booga {
     background: blue;
 }
diff --git a/packages/core/test/__snapshots__/options.test.js.snap b/packages/core/test/__snapshots__/options.test.js.snap
index 02bfad69..1aba9209 100644
--- a/packages/core/test/__snapshots__/options.test.js.snap
+++ b/packages/core/test/__snapshots__/options.test.js.snap
@@ -49,28 +49,28 @@ a {}"
 
 exports[`/processor.js options lifecycle options done should run async postcss plugins done processing 1`] = `
 "/* packages/core/test/specimens/async-done.css */
-
 a {}"
 `;
 
 exports[`/processor.js options lifecycle options done should run sync postcss plugins done processing 1`] = `
 "/* packages/core/test/specimens/sync-done.css */
-
 a {}"
 `;
 
+exports[`/processor.js options lifecycle options done should work with cssnano (default preset) 1`] = `".folder{margin:2px}.booga{background:green}"`;
+
+exports[`/processor.js options lifecycle options done should work with cssnano (no preset) 1`] = `".folder{margin:2px}.booga{background:green}"`;
+
 exports[`/processor.js options map should generate source maps 1`] = `
 "/* packages/core/test/specimens/folder/folder.css */
 .folder { margin: 2px; }
-
 /* packages/core/test/specimens/local.css */
 .booga { background: green; }
-
 /* packages/core/test/specimens/start.css */
 .booga { color: red; background: blue; }
 .tooga { border: 1px solid white; }
 
-/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInBhY2thZ2VzL2NvcmUvdGVzdC9zcGVjaW1lbnMvZm9sZGVyL2ZvbGRlci5jc3MiLCJwYWNrYWdlcy9jb3JlL3Rlc3Qvc3BlY2ltZW5zL2xvY2FsLmNzcyIsInBhY2thZ2VzL2NvcmUvdGVzdC9zcGVjaW1lbnMvc3RhcnQuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9EQUFDO0FBQ0QsVUFBVSxZQUFZLEVBQUU7O0FDRHhCLDRDQUFDO0FBSUQsU0FBUyxrQkFBa0IsRUFBRTs7QUNKN0IsNENBQUM7QUFFRCxTREZBLFdBQWdCLENBQ2hCLGlCQUFpQixFQ0NzQjtBQUN2QyxTRkhBLHdCQUFxQixFRUdlIiwiZmlsZSI6Im91dC5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyJAdmFs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OiAycHg7IH1cbiIsIkB2YWx1ZSBvbmU6IHJlZDtcbkB2YWx1ZSB0d286IGJsdWU7XG5AdmFsdWUgZm9sZGVyIGZyb20gXCIuL2ZvbGRlci9mb2xkZXIuY3NzXCI7XG5cbi5ib29nYSB7IGJhY2tncm91bmQ6IGdyZWVuOyB9XG4ubG9vZ2EgeyBjb21wb3NlczogYm9vZ2E7IH1cbiIsIkB2YWx1ZSBvbmUsIHR3bywgZm9sZGVyIGZyb20gXCIuL2xvY2FsLmNzc1wiO1xuLndvb2dhIHsgY29tcG9zZXM6IGJvb2dhIGZyb20gXCIuL2xvY2FsLmNzc1wiOyB9XG4uYm9vZ2EgeyBjb2xvcjogb25lOyBiYWNrZ3JvdW5kOiB0d287IH1cbi50b29nYSB7IGJvcmRlcjogMXB4IHNvbGlkIGZvbGRlcjsgfVxuIl19 */"
 `;
 
 exports[`/processor.js options namer should require a namer if a string is passed 1`] = `
diff --git a/packages/core/test/__snapshots__/values.test.js.snap b/packages/core/test/__snapshots__/values.test.js.snap
index 3f12d7b0..acd71b75 100644
--- a/packages/core/test/__snapshots__/values.test.js.snap
+++ b/packages/core/test/__snapshots__/values.test.js.snap
@@ -15,8 +15,6 @@ exports[`/processor.js values should support simple values 1`] = `
 
 exports[`/processor.js values should support value composition 1`] = `
 "/* packages/core/test/specimens/values.css */
-
-
 /* packages/core/test/specimens/value-composition.css */
 .red {
     color: red;
@@ -26,8 +24,6 @@ exports[`/processor.js values should support value composition 1`] = `
 
 exports[`/processor.js values should support value namespaces 1`] = `
 "/* packages/core/test/specimens/values.css */
-
-
 /* packages/core/test/specimens/value-namespace.css */
 .red {
     color: red;
@@ -42,18 +38,14 @@ exports[`/processor.js values should support value namespaces 1`] = `
 exports[`/processor.js values should support value replacement in :external(...) 1`] = `
 "/* packages/core/test/specimens/folder/folder.css */
 .folder { margin: 2px; }
-
 /* packages/core/test/specimens/simple.css */
 .wooga { color: red; }
-
 /* packages/core/test/specimens/local.css */
 .booga { background: green; }
-
 /* packages/core/test/specimens/externals.css */
 .a .wooga {
     color: green;
 }
-
 .b:hover .booga {
     background: blue;
 }
diff --git a/packages/core/test/issues/__snapshots__/issue-191.test.js.snap b/packages/core/test/issues/__snapshots__/issue-191.test.js.snap
index 0e358ddf..80ff49d1 100644
--- a/packages/core/test/issues/__snapshots__/issue-191.test.js.snap
+++ b/packages/core/test/issues/__snapshots__/issue-191.test.js.snap
@@ -5,8 +5,6 @@ exports[`/issues /191 should ignore case differences in file paths 1`] = `
 .fooga {
     color: #F00;
 }
-
 /* packages/core/test/issues/specimens/191/start.css */
-
 "
 `;
diff --git a/packages/core/test/issues/__snapshots__/issue-24.test.js.snap b/packages/core/test/issues/__snapshots__/issue-24.test.js.snap
index cd7273c2..c13518c9 100644
--- a/packages/core/test/issues/__snapshots__/issue-24.test.js.snap
+++ b/packages/core/test/issues/__snapshots__/issue-24.test.js.snap
@@ -12,9 +12,9 @@ Object {
 exports[`/issues /24 should be able to compose using a value 2`] = `
 "/* packages/core/test/specimens/simple.css */
 .wooga { color: red; }
-
 /* packages/core/test/specimens/composition.css */
 .a {
     background: #000;
-}"
+}
+"
 `;
diff --git a/packages/core/test/issues/__snapshots__/issue-261.test.js.snap b/packages/core/test/issues/__snapshots__/issue-261.test.js.snap
index eda188b9..b32549fa 100644
--- a/packages/core/test/issues/__snapshots__/issue-261.test.js.snap
+++ b/packages/core/test/issues/__snapshots__/issue-261.test.js.snap
@@ -5,7 +5,6 @@ exports[`/issues /261 should allow colons in rules that also use :external() 1`]
 .mcaafb0c20_a {
     color: red;
 }
-
 /* packages/core/test/issues/specimens/261/2.css */
 .mcdbec3a1b_b:hover .mcaafb0c20_a {
     color: blue;
diff --git a/packages/core/test/options.test.js b/packages/core/test/options.test.js
index a3a3c308..fc900f13 100644
--- a/packages/core/test/options.test.js
+++ b/packages/core/test/options.test.js
@@ -244,6 +244,36 @@ describe("/processor.js", function() {
                     .then(() => processor.output())
                     .then((result) => expect(result.css).toMatchSnapshot());
                 });
+
+                it("should work with cssnano (no preset)", () => {
+                    var processor = new Processor({
+                            namer,
+                            done : [ require("cssnano") ]
+                        });
+
+                    return processor.file(
+                        "./packages/core/test/specimens/local.css"
+                    )
+                    .then(() => processor.output({ to : "./packages/core/test/output/local.css" }))
+                    .then((result) => expect(result.css).toMatchSnapshot());
+                });
+
+                it("should work with cssnano (default preset)", () => {
+                    var processor = new Processor({
+                            namer,
+                            done : [
+                                require("cssnano")({
+                                    preset : "default"
+                                })
+                            ]
+                        });
+
+                    return processor.file(
+                        "./packages/core/test/specimens/local.css"
+                    )
+                    .then(() => processor.output({ to : "./packages/core/test/output/local.css" }))
+                    .then((result) => expect(result.css).toMatchSnapshot());
+                });
             });
         });
     });
diff --git a/packages/glob/test/__snapshots__/glob.test.js.snap b/packages/glob/test/__snapshots__/glob.test.js.snap
index 630c7d95..0934e6ab 100644
--- a/packages/glob/test/__snapshots__/glob.test.js.snap
+++ b/packages/glob/test/__snapshots__/glob.test.js.snap
@@ -5,17 +5,14 @@ exports[`/glob.js should find files on disk & output css 1`] = `
 .one {
     color: red;
 }
-
 /* dir/3.css */
 .three {
     color: white;
 }
-
 /* exclude/4.css */
 .four {
     color: red;
 }
-
 /* dir/2.css */
 .two {
     
@@ -29,12 +26,10 @@ exports[`/glob.js should support exclusion patterns 1`] = `
 .one {
     color: red;
 }
-
 /* dir/3.css */
 .three {
     color: white;
 }
-
 /* dir/2.css */
 .two {
     
@@ -48,17 +43,14 @@ exports[`/glob.js should use a default search 1`] = `
 .one {
     color: red;
 }
-
 /* dir/3.css */
 .three {
     color: white;
 }
-
 /* exclude/4.css */
 .four {
     color: red;
 }
-
 /* dir/2.css */
 .two {
     
diff --git a/packages/rollup/test/__snapshots__/rollup.test.js.snap b/packages/rollup/test/__snapshots__/rollup.test.js.snap
index 0641dd82..7c813c04 100644
--- a/packages/rollup/test/__snapshots__/rollup.test.js.snap
+++ b/packages/rollup/test/__snapshots__/rollup.test.js.snap
@@ -98,8 +98,7 @@ exports[`/rollup.js watch should generate correct builds in watch mode when file
 /* packages/rollup/test/specimens/simple.css */
 .mc12d71625_fooga {
     color: red;
-}
-"
+}"
 `;
 
 exports[`/rollup.js watch should generate correct builds in watch mode when files change 2`] = `
@@ -108,6 +107,5 @@ exports[`/rollup.js watch should generate correct builds in watch mode when file
 /* packages/rollup/test/specimens/simple.css */
 .mc12d71625_fooga {
     color: red;
-}
-"
+}"
 `;
diff --git a/packages/webpack/test/__snapshots__/webpack.test.js.snap b/packages/webpack/test/__snapshots__/webpack.test.js.snap
index 9f340768..054f1f0f 100644
--- a/packages/webpack/test/__snapshots__/webpack.test.js.snap
+++ b/packages/webpack/test/__snapshots__/webpack.test.js.snap
@@ -606,10 +606,8 @@ __webpack_require__(0);
 exports[`/webpack.js should handle dependencies 2`] = `
 "/* packages/webpack/test/specimens/folder/folder.css */
 .folder { margin: 2px; }
-
 /* packages/webpack/test/specimens/local.css */
 .booga { background: green; }
-
 /* packages/webpack/test/specimens/start.css */
 .booga { color: red; background: blue; }
 .tooga { border: 1px solid white; }