Skip to content

Commit

Permalink
fix: minimize exports in extract mode as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed May 12, 2020
1 parent 840996c commit ab919d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions __tests__/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1177,9 +1177,9 @@ injector_e1c140db(css_427c8846);
exports[`minimize extract: css 1`] = `".bar,.foo,.stylus{color:red}.stylus{background:red}.pcss,.sass{color:red}.sass{width:30%}.less{color:#6c94be}"`;

exports[`minimize extract: js 1`] = `
"const css_a87c82eb = \\".foo {\\\\n color: red;\\\\n}\\\\n\\";
"const css_a87c82eb = \\".foo{color:red}\\";
const css_6e569e18 = \\".bar {\\\\n color: red;\\\\n}\\\\n\\";
const css_6e569e18 = \\".bar{color:red}\\";
console.log(css_a87c82eb, css_6e569e18);
"
Expand All @@ -1191,9 +1191,9 @@ exports[`minimize extract-sourcemap-inline: css 1`] = `
`;

exports[`minimize extract-sourcemap-inline: js 1`] = `
"const css_a87c82eb = \\".foo {\\\\n color: red;\\\\n}\\\\n\\";
"const css_a87c82eb = \\".foo{color:red}\\";
const css_6e569e18 = \\".bar {\\\\n color: red;\\\\n}\\\\n\\";
const css_6e569e18 = \\".bar{color:red}\\";
console.log(css_a87c82eb, css_6e569e18);
"
Expand All @@ -1205,9 +1205,9 @@ exports[`minimize extract-sourcemap-true: css 1`] = `
`;

exports[`minimize extract-sourcemap-true: js 1`] = `
"const css_a87c82eb = \\".foo {\\\\n color: red;\\\\n}\\\\n\\";
"const css_a87c82eb = \\".foo{color:red}\\";
const css_6e569e18 = \\".bar {\\\\n color: red;\\\\n}\\\\n\\";
const css_6e569e18 = \\".bar{color:red}\\";
console.log(css_a87c82eb, css_6e569e18);
"
Expand Down
3 changes: 1 addition & 2 deletions src/loaders/postcss/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ const loader: Loader<PostCSSLoaderOptions> = {
);
}

// If extracting, minimization is performed afterwards
if (!options.extract && options.minimize)
if (options.minimize)
plugins.push(cssnano(typeof options.minimize === "object" ? options.minimize : {}));

// Avoid PostCSS warning
Expand Down

0 comments on commit ab919d7

Please sign in to comment.