-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (47 loc) · 1.42 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
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
jsFiles = ['*.js', 'src/**/*.js'],
jshint = require('gulp-jshint'),
jscs = require('gulp-jscs');
//Default gulp task with just nodemon retarting on changes. The serve task below is more advanced taking in other tasks as well
//gulp.task('default', function () {
// nodemon({
// script: 'app.js',
// ext: 'js',
// env: {
// PORT: 5000
// },
// ignore: ['./node_modules/**']
// })
// .on('restart', function () {
// console.log('restarting');
// });
//});
gulp.task('style', function () {
//When i return it, i can use it as a subtask somewhere else
return gulp.src(jsFiles)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish', {
verbose: true
}))
.pipe(jscs())
.pipe(jscs.reporter());
});
gulp.task('serve', ['style'], function() {
//Options for nodemon: script: what nodemon should run on restart.
//delaytime: wait a second before it runs the restart
//env: environment variables
//watch: what should nodemon look for changes in?
var options = {
script: 'app.js',
delayTime : 1,
env: {
'PORT': 5000
},
watch: jsFiles
};
return nodemon(options)
.on('restart', function(ev) {
console.log('restarting...');
});
});