-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathGulpfile.js
38 lines (30 loc) · 1.02 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
'use strict';
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
watch = require('gulp-watch'),
jshint = require('gulp-jshint'),
livereload = require('gulp-livereload');
//register nodemon task
gulp.task('nodemon', function () {
nodemon({ script: './bin/www', env: { 'NODE_ENV': 'development' }})
.on('restart');
});
// Rerun the task when a file changes
gulp.task('watch', function() {
var server = livereload();
gulp.src(['*.js','routes/*.js', 'public/*.js'], { read: true })
.pipe(watch({ emit: 'all' }))
.pipe(jshint())
.pipe(jshint.reporter('default'));
gulp.watch(['*.js','routes/*.js', 'views/**/*.*', 'public/**/*.*']).on('change', function(file) {
server.changed(file.path);
});
});
//lint js files
gulp.task('lint', function() {
gulp.src(['*.js','routes/*.js', 'public/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['lint','nodemon', 'watch']);