Skip to content

Commit

Permalink
fix: dist环境提取出css
Browse files Browse the repository at this point in the history
  • Loading branch information
halwu(吴浩麟) committed Jun 17, 2017
1 parent df07bb1 commit 7c546f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"compass-mixins": "^0.12.10",
"css-loader": "^0.28.2",
"end-webpack-plugin": "^1.0.0",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.11.1",
"gh-pages": "^1.0.0",
"node-sass": "^4.5.3",
Expand Down
19 changes: 17 additions & 2 deletions webpack-dist.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require('fs');
const path = require('path');
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const EndWebpackPlugin = require('end-webpack-plugin');
const { WebPlugin } = require('web-webpack-plugin');
const ghpages = require('gh-pages');
Expand All @@ -23,12 +24,22 @@ module.exports = {
rules: [
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader?minimize', 'sass-loader'],
// 提取出css
loaders: ExtractTextPlugin.extract({
fallback: 'style-loader',
// 压缩css
use: ['css-loader?minimize', 'sass-loader']
}),
include: path.resolve(__dirname, 'src')
},
{
test: /\.css$/,
loaders: ['style-loader', 'css-loader?minimize'],
// 提取出css
loaders: ExtractTextPlugin.extract({
fallback: 'style-loader',
// 压缩css
use: ['css-loader?minimize'],
}),
},
{
test: /\.(gif|png|jpe?g|eot|woff|ttf|svg|pdf)$/,
Expand Down Expand Up @@ -66,6 +77,10 @@ module.exports = {
filename: 'index.html',
requires: ['main'],
}),
new ExtractTextPlugin({
filename: '[name]_[contenthash].css',
allChunks: true,
}),
new EndWebpackPlugin(() => {
ghpages.publish(outputPath, { dotfiles: true }, (err) => {
if (err) {
Expand Down

0 comments on commit 7c546f4

Please sign in to comment.