-
Notifications
You must be signed in to change notification settings - Fork 26
/
gulpfile.js
50 lines (40 loc) · 1.03 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
(function() {
'use strict';
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
watch = require('gulp-watch'),
jshint = require('gulp-jshint'),
livereload = require('gulp-livereload'),
_paths = ['server/**/*.js', 'client/js/*.js'];
//register nodemon task
gulp.task('nodemon', function() {
nodemon({
script: 'server/app.js',
env: {
'NODE_ENV': 'development'
}
})
.on('restart');
});
// Rerun the task when a file changes
gulp.task('watch', function() {
livereload.listen();
gulp.src(_paths, {
read: false
})
.pipe(watch({
emit: 'all'
}))
.pipe(jshint())
.pipe(jshint.reporter('default'));
gulp.watch(_paths).on('change', livereload.changed);
});
//lint js files
gulp.task('lint', function() {
gulp.src(_paths)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['lint', 'nodemon', 'watch']);
}());