Skip to content

Commit 812edb2

Browse files
committed
Moving minification options
The previous spot is an outdated spot anyways, and it caused an edge-case bug with resolution of some SASS paths: symfony/demo#586
1 parent a60bbdf commit 812edb2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/config-generator.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class ConfigGenerator {
100100
buildRulesConfig() {
101101
const cssLoaders = [
102102
{
103-
loader: 'css-loader' + this.getSourceMapOption(),
103+
loader: 'css-loader' + this.getSourceMapOption()+(this.webpackConfig.isProduction() ? '?minimize=1' : ''),
104104
},
105105
];
106106
if (this.webpackConfig.usePostCssLoader) {
@@ -292,7 +292,6 @@ class ConfigGenerator {
292292
* https://github.com/jtangelder/sass-loader/issues/285
293293
*/
294294
plugins.push(new webpack.LoaderOptionsPlugin({
295-
minimize: this.webpackConfig.isProduction(),
296295
debug: !this.webpackConfig.isProduction(),
297296
options: {
298297
context: this.webpackConfig.getContext(),

test/functional.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,13 +414,19 @@ describe('Functional tests using webpack', function() {
414414
const config = createWebpackConfig('www/build', 'production');
415415
config.setPublicPath('/build');
416416
config.addEntry('main', ['./js/no_require']);
417+
config.addEntry('styles', './css/h1_style.css');
417418

418419
testSetup.runWebpack(config, (webpackAssert) => {
419420
// the comment should not live in the file
420421
webpackAssert.assertOutputFileDoesNotContain(
421422
'main.js',
422423
'// comments in no_require.js'
423424
);
425+
// extra spaces should not live in the CSS file
426+
webpackAssert.assertOutputFileDoesNotContain(
427+
'styles.css',
428+
' font-size: 50px;'
429+
);
424430

425431
done();
426432
});

0 commit comments

Comments
 (0)