...
|
...
|
@@ -15,7 +15,7 @@ const sourcemaps = require('gulp-sourcemaps'); |
|
|
const cssnano = require('gulp-cssnano');
|
|
|
|
|
|
const webpack = require('webpack');
|
|
|
const webpackDevServer = require('webpack-dev-server');
|
|
|
const WebpackDevServer = require('webpack-dev-server');
|
|
|
const webpackConfig = require('./webpack.config.js');
|
|
|
|
|
|
const env = {
|
...
|
...
|
@@ -52,6 +52,8 @@ const postcssPlugin = (et) => { |
|
|
|
|
|
group = group === '' ? 'yo' : group;
|
|
|
|
|
|
file.retina = true;
|
|
|
|
|
|
return group ? Promise.resolve(group) : Promise.reject(group);
|
|
|
}
|
|
|
},
|
...
|
...
|
@@ -91,6 +93,13 @@ const postcssPlugin = (et) => { |
|
|
require('postcss-assets')(assets),
|
|
|
require('postcss-calc'),
|
|
|
require('postcss-opacity'),
|
|
|
require('postcss-pxtorem')({
|
|
|
rootValue: 40,
|
|
|
unitPrecision: 5, // 保留5位小数字
|
|
|
minPixelValue: 2, // 小于 2 时,不转换
|
|
|
selectorBlackList: [], // 选择器黑名单,可以使用正则
|
|
|
propWhiteList: [] // 属性名称为空,表示替换所有属性的值
|
|
|
}),
|
|
|
|
|
|
// 可选
|
|
|
require('postcss-use')({
|
...
|
...
|
@@ -165,7 +174,7 @@ gulp.task('webpack-dev-server', () => { |
|
|
debug: true
|
|
|
});
|
|
|
|
|
|
new webpackDevServer(webpack(devConfig), {
|
|
|
new WebpackDevServer(webpack(devConfig), {
|
|
|
contentBase: '.',
|
|
|
publicPath: '//localhost:8000/',
|
|
|
hot: true,
|
...
|
...
|
@@ -185,7 +194,7 @@ gulp.task('webpack', () => { |
|
|
var proConfig = Object.assign({}, webpackConfig);
|
|
|
|
|
|
proConfig.output.path = dist.js;
|
|
|
webpack(proConfig, (err, stats) => {
|
|
|
webpack(proConfig, (err) => {
|
|
|
if (err) {
|
|
|
throw new gutil.PluginError('webpack', err);
|
|
|
}
|
...
|
...
|
|