forked from GLO3102/UMovie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
36 lines (31 loc) · 808 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
var gulp = require('gulp');
var gutil = require('gulp-util');
var runSequence = require('run-sequence');
var spawn = require('child_process').spawn;
var symlink = require('gulp-symlink');
var node;
var paths = {
server: ['index.js', './models/**/*.js', './routes/**/*.js']
};
gulp.task('server', function () {
if (node) {
node.kill();
}
node = spawn('node', paths.server, {stdio: 'inherit'});
node.on('close', function (code) {
if (code === 8) {
gutil.log('Error detected, waiting for changes...');
}
});
});
gulp.task('watch', function () {
gulp.watch(paths.server, ['server']);
});
gulp.task('default', function () {
runSequence('server', 'watch');
});
process.on('exit', function () {
if (node) {
node.kill();
}
});