From 3ac8c6f6d626d44c541aca55b725f9d1f5480f6b Mon Sep 17 00:00:00 2001 From: JounQin Date: Sun, 15 Jan 2017 12:29:22 +0800 Subject: [PATCH 1/3] Init `minimizeOptions` should be `query.minimize`! It's a mistake according to the doc. Init `minimizeOptions` should be `query.minimize` rather than just query. Please review it immediately. https://github.com/webpack/css-loader#minification --- lib/processCss.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/processCss.js b/lib/processCss.js index c6e8d102..60b81360 100644 --- a/lib/processCss.js +++ b/lib/processCss.js @@ -179,7 +179,7 @@ module.exports = function processCss(inputSource, inputMap, options, callback) { ]); if(minimize) { - var minimizeOptions = assign({}, query); + var minimizeOptions = assign({}, query.minimize); ["zindex", "normalizeUrl", "discardUnused", "mergeIdents", "reduceIdents", "autoprefixer"].forEach(function(name) { if(typeof minimizeOptions[name] === "undefined") minimizeOptions[name] = false; From c7683a92c435ea1f33e76b1739c953bfcf371e1f Mon Sep 17 00:00:00 2001 From: JounQin Date: Thu, 9 Mar 2017 10:39:34 +0800 Subject: [PATCH 2/3] fix test error --- test/moduleMinimizeTest.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/moduleMinimizeTest.js b/test/moduleMinimizeTest.js index bbc47f5c..5b862ea4 100644 --- a/test/moduleMinimizeTest.js +++ b/test/moduleMinimizeTest.js @@ -12,6 +12,13 @@ describe("module minimize", function() { var source = fs.readFileSync(path.join(testCasesPath, name, "source.css"), "utf-8"); var expected = fs.readFileSync(path.join(testCasesPath, name, "expected.css"), "utf-8"); - test(name, source, expected, "?module&minimize&sourceMap&-discardComments&localIdentName=_[local]_"); + test(name, source, expected, '?' + JSON.stringify({ + module:true, + sourceMap: true, + minimize: { + discardComments: false + }, + localIdentName: '_[local]_' + })); }); }); From 58c41ceb9b0f7452e160e8c487c2bb47bcdf1d1e Mon Sep 17 00:00:00 2001 From: JounQin Date: Thu, 9 Mar 2017 10:46:54 +0800 Subject: [PATCH 3/3] fix test error --- test/moduleMinimizeTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/moduleMinimizeTest.js b/test/moduleMinimizeTest.js index 5b862ea4..7efa9979 100644 --- a/test/moduleMinimizeTest.js +++ b/test/moduleMinimizeTest.js @@ -13,7 +13,7 @@ describe("module minimize", function() { var expected = fs.readFileSync(path.join(testCasesPath, name, "expected.css"), "utf-8"); test(name, source, expected, '?' + JSON.stringify({ - module:true, + module: true, sourceMap: true, minimize: { discardComments: false