FIX: webpack CSS minifiction

This commit is contained in:
Tony Air 2019-09-07 10:06:25 +07:00
parent f713b7e9cd
commit b2de1a54a0
2 changed files with 14 additions and 0 deletions

View File

@ -102,6 +102,7 @@
"uglify-js": "git://github.com/mishoo/UglifyJS2.git#harmony-v2.8.22", "uglify-js": "git://github.com/mishoo/UglifyJS2.git#harmony-v2.8.22",
"uglifyjs-webpack-plugin": "^2.2.0", "uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^0.6.2", "url-loader": "^0.6.2",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"webpack": "^4.39.1", "webpack": "^4.39.1",
"webpack-cli": "^3.3.6", "webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.8.0", "webpack-dev-server": "^3.8.0",

View File

@ -15,6 +15,7 @@ const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin'); const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
let plugins = [ let plugins = [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
@ -52,6 +53,18 @@ let plugins = [
windows: true windows: true
} }
}), }),
new OptimizeCssAssetsPlugin({
//assetNameRegExp: /\.optimize\.css$/g,
cssProcessor: require('cssnano'),
cssProcessorPluginOptions: {
preset: ['default', {
discardComments: {
removeAll: true
}
}],
},
canPrint: true
}),
]; ];
// add themes favicons // add themes favicons