-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.babel.js
49 lines (40 loc) · 1.14 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
/*jshint esversion: 6*/
import gulp from 'gulp';
import babel from 'gulp-babel';
import nodemon from 'gulp-nodemon';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
gulp.task('copy', () => {
return gulp
.src(['./client/**/*', '!./client/**/*.js'])
.pipe(gulp.dest('./dist', {
overwrite: true
}));
});
gulp.task('transpile', ['copy'], () => {
gulp.src(['./client/**/*.js'])
.pipe(babel())
.pipe(gulp.dest('./dist', {
overwrite: true
}));
});
gulp.task('browserify', ['transpile'], function() {
return browserify('./dist/app/main.js')
.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('./dist/app/'));
});
gulp.task('server', ['browserify'], function() {
nodemon({
script: 'server/app.js',
watch: ["server/"],
ext: 'js'
}).on('restart', () => {
gulp.src('server.js')
.pipe(notify('Running the start tasks and stuff'));
});
});
// gulp.task('watch', () => {
// gulp.watch('./*.js', ['transpile']);
// });
gulp.task('default', ['copy', 'transpile', 'browserify', 'server']);