-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
37 lines (31 loc) · 872 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
36
37
const {watch, src, series, parallel, dest} = require('gulp');
const webserver = require('gulp-webserver');
const del = require('del');
const webpack = require('webpack-stream');
const webpackConfig = require('./webpack.config.js');
function cleanBuild() {
return del('./public/js/*');
}
function build() {
return src('./index.web.js')
.pipe(webpack(webpackConfig))
.on('error', function handleError() {
this.emit('end'); // Recover from errors
})
.pipe(dest('./'));
}
function watchChanges() {
watch(['./app/**/**/**/*', './public/css/**/*', './index.web.js'], build);
}
function serve() {
src('public').pipe(
webserver({
fallback: 'index.html',
livereload: true,
directoryListing: false,
open: true,
}),
);
}
exports.build = series(cleanBuild, build);
exports.default = parallel(serve, watchChanges);