-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
35 lines (28 loc) · 856 Bytes
/
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
// Dependencies
var gulp = require('gulp');
var webpack = require('webpack');
var gutil = require('gulp-util');
// Configurations
var webpackConfig = require('./webpack.config');
var getWebpackCallback = function(cb) {
return function(err, stats) {
if (err)
throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
chunks: false, // Makes the build much quieter
colors: true
}));
if (cb) {
if (stats.hasErrors() || stats.hasWarnings())
cb('webpack failed');
else
cb();
}
}
}
gulp.task('build', function(cb) {
return webpack(webpackConfig).run(getWebpackCallback(cb));
});
gulp.task('watch', function () {
webpack(webpackConfig).watch({}, getWebpackCallback());
});