-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
60 lines (52 loc) · 1 KB
/
gulpfile.babel.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const gulp = require('gulp')
const babel = require('gulp-babel')
const pug = require('gulp-pug')
const pump = require('pump')
const connect = require('gulp-connect')
const uglify = require('gulp-uglify');
const roots = {
src: 'app',
dest: 'package'
}
const srcs = {
JS: "app/main.js",//`${roots.src}/*.js`,
PUG: "app/index.pug"//`${roots.src}/*.pug`
}
const dests = {
JS: "package/",//`${roots.dest}/main.js`,
PUG: "package/"//`${roots.dest}/index.html`
}
gulp.task('js', (cb) => {
pump(
[
gulp.src(srcs.JS),
babel({
presets: ['es2015', 'stage-0']
}),
uglify(),
gulp.dest(dests.JS)
],
cb
)
})
gulp.task('pug', (cb) => {
pump(
[
gulp.src(srcs.PUG),
pug(),
gulp.dest(dests.PUG)
],
cb
)
})
gulp.task('watch', _ => {
gulp.watch(srcs.PUG, ['pug'])
gulp.watch(srcs.JS, ['js'])
})
gulp.task('connect', _ => {
connect.server({
root: './',
port: 5000
})
})
gulp.task('default', ['connect', 'pug', 'js', 'watch'])