Build: Minimizing css and js for Element doc site (#14430)

* build: build css minimizing for production

* build: JS Minimizing For Production

* build: run only in production
pull/14432/head
iamkun 2019-02-20 19:06:18 +08:00 committed by Zhi Cun
parent 455265b96e
commit 4aa85ef3c8
3 changed files with 698 additions and 17 deletions

View File

@ -5,6 +5,8 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const md = require('markdown-it')();
const slugify = require('transliteration').slugify;
@ -185,7 +187,10 @@ const webpackConfig = {
}
}
})
]
],
optimization: {
minimizer: []
}
};
if (isProd) {
@ -194,6 +199,14 @@ if (isProd) {
filename: '[name].[contenthash:7].css'
})
);
webpackConfig.optimization.minimizer.push(
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: false
}),
new OptimizeCSSAssetsPlugin({})
);
}
module.exports = webpackConfig;

View File

@ -110,6 +110,7 @@
"mini-css-extract-plugin": "^0.4.1",
"mocha": "^3.1.1",
"node-sass": "^4.5.3",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"perspective.js": "^1.0.0",
"postcss": "^5.1.2",
"postcss-loader": "^2.1.5",
@ -122,6 +123,7 @@
"sinon-chai": "^2.8.0",
"style-loader": "^0.19.0",
"transliteration": "^1.1.11",
"uglifyjs-webpack-plugin": "^2.1.1",
"uppercamelcase": "^1.1.0",
"url-loader": "^1.0.1",
"vue": "^2.5.16",

698
yarn.lock

File diff suppressed because it is too large Load Diff