-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgulpfile.js
40 lines (30 loc) · 1.09 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';
var gulp = require('gulp'),
webpack = require('webpack'),
WebpackDevServer = require('webpack-dev-server'),
webserver = require('gulp-webserver'),//web服务
gutil = require("gulp-util");
var webpackConf = require('./webpack.config');
var src = process.cwd() + '/www';
gulp.task('webserver', function(callback) {
var WebpackDevServer = require('webpack-dev-server');
var compiler = webpack(webpackConf);
var devSvr = new WebpackDevServer(compiler, {
contentBase: './www',
publicPath : webpackConf.output.publicPath,
stats : webpackConf.devServer.stats
});
devSvr.listen(8001, '0.0.0.0', function(err) {
if(err) throw new gutil.PluginError('webpack-dev-server', err);
gutil.log('[webpack-dev-server]','http://localhost:8001');
});
});
gulp.task('build', function(callback) {
webpack(webpackConf, function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
// output options
}));
callback();
});
});