-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (36 loc) · 1.13 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
//gulpfile.js
var gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
del = require('del'),
runSequence = require('run-sequence'),
browserSync = require('browser-sync'),
pagespeed = require('psi'),
reload = browserSync.reload,
nodemon = require('gulp-nodemon')();
gulp.task('jshint', function () {
return gulp.src(['/api/*.js', '/data/*.js'])
.pipe(reload({ stream: true, once: true }))
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.if(!browserSync.active, $.jshint.reporter('fail')));
});
gulp.task('serve', function () {
// browserSync({
// notify: false,
// logPrefix: 'browser-sync'//,
// // server: ['.tmp', './'],
// // port: 5000
// });
gulp.watch(['api/*.js', 'data/*.js'], reload);
nodemon({ script: 'app.js' })
.on('error', function (err){
console.error(err);
})
.on('restart', function () {
console.info('server restarted');
});
})
gulp.task('default', function(cb){
console.log('starting gulp default task');
runSequence('jshint', ['serve'], cb);
});