文档页样式优化和打包配置优化 (#8)

* 文档页样式和打包配置优化

* upload unit test
This commit is contained in:
张敏
2017-04-25 14:37:11 +08:00
committed by GitHub
parent 034c66a77f
commit 94a1e83185
13 changed files with 158 additions and 160 deletions
@@ -5,10 +5,8 @@ var striptags = require('./strip-tags');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var getPoastcssPlugin = require('./utils/postcss_pipe');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
var FaviconsWebpackPlugin = require('favicons-webpack-plugin');
var StyleExtractPlugin;
if (process.env.NODE_ENV === 'production') {
@@ -172,66 +170,3 @@ module.exports = {
StyleExtractPlugin
]
};
if (process.env.NODE_ENV === 'production') {
delete module.exports.devtool;
module.exports.output = {
path: path.join(__dirname, '../docs/dist'),
publicPath: '/zanui/vue',
filename: '[name].[hash:8].js'
};
module.exports.plugins = module.exports.plugins.concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_console: true
},
output: {
comments: false
},
sourceMap: false
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
}),
new FaviconsWebpackPlugin({
// Your source logo
logo: path.join(__dirname, '../docs/assets/ZanUIlogo256x256.png'),
// The prefix for all image files (might be a folder or a name)
prefix: 'favico-[hash]-',
// Emit all stats of the generated icons
// emitStats: false,
// The name of the json containing all favicon information
// statsFilename: 'iconstats-[hash].json',
// Generate a cache file with control hashes and
// don't rebuild the favicons until those hashes change
persistentCache: false,
// Inject the html into the html-webpack-plugin
inject: true,
// favicon background color (see https://github.com/haydenbleasel/favicons#usage)
background: '#fff',
// favicon app title (see https://github.com/haydenbleasel/favicons#usage)
title: 'Vant',
// which icons should be generated (see https://github.com/haydenbleasel/favicons#usage)
icons: {
android: true,
appleIcon: true,
appleStartup: true,
coast: false,
favicons: true,
firefox: true,
opengraph: false,
twitter: false,
yandex: false,
windows: false
}
})
]);
}
+34
View File
@@ -0,0 +1,34 @@
var webpack = require('webpack');
var merge = require('webpack-merge');
var path = require('path');
var devConfig = require('./webpack.config.dev.js');
module.exports = merge(devConfig, {
output: {
path: path.join(__dirname, '../docs/dist'),
publicPath: '/zanui/vue',
filename: '[name].[hash:8].js'
},
devtool: false,
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_console: true
},
output: {
comments: false
},
sourceMap: false
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
})
]
});