-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
29 lines (23 loc) · 743 Bytes
/
Copy pathgulpfile.js
File metadata and controls
29 lines (23 loc) · 743 Bytes
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
const gulp = require('gulp');
const babel = require('gulp-babel');
const watch = require('gulp-watch');
const spawn = require('child_process').spawn;
gulp.task('default', ['js', 'copy', 'watch']);
gulp.task('js', () => {
return gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist'));
});
gulp.task('copy', () => {
return gulp.src('src/**/*.json')
.pipe(gulp.dest('dist'));
})
gulp.task('serve', ['js', 'copy'], function() {
spawn('node', ['dist/server.js'], { stdio: 'inherit' });
});
gulp.task('watch', function () {
// Callback mode, useful if any plugin in the pipeline depends on the `end`/`flush` event
gulp.watch('src/**/*.js', ['js'])
});