Skip to content

Commit c73f14c

Browse files
committed
added css-minification
1 parent a22d1f6 commit c73f14c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"locks": "^0.2.2",
4040
"mini-css-extract-plugin": "^0.4.1",
4141
"node-sass": "^4.9.3",
42+
"optimize-css-assets-webpack-plugin": "^5.0.1",
4243
"prop-types": "^15.6.2",
4344
"react": "^16.4.2",
4445
"react-dom": "^16.4.2",

webpack.config.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
22
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
3-
3+
var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
44
/**
55
* TODO remove when webpack fixed this error:
66
* Links to this error:
@@ -61,6 +61,7 @@ module.exports = (env, argv) => {
6161
loader: "css-loader",
6262
options: {
6363
"sourceMap": !isProduction,
64+
"minimize": isProduction
6465
}
6566
},
6667
"resolve-url-loader",
@@ -124,7 +125,13 @@ module.exports = (env, argv) => {
124125
new FixStyleOnlyEntriesPlugin(),
125126
new MiniCssExtractPlugin({
126127
filename: "[name].css"
127-
})
128+
}),
129+
(isProduction) ?
130+
new OptimizeCssAssetsPlugin({
131+
cssProcessorPluginOptions: {
132+
preset: ['default', { discardComments: { removeAll: true } }],
133+
},
134+
}) : () => {}
128135
]
129136
}
130137
}

0 commit comments

Comments
 (0)