-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgulpfile.js
42 lines (36 loc) · 985 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
37
38
39
40
41
42
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var nodemon = require('gulp-nodemon');
var jshint = require('gulp-jshint');
gulp.task('browser-sync', ['nodemon'], function() {
browserSync.init(null, {
proxy: 'http://localhost:8100',
files: ['**'],
browser: 'chrome',
notify: false,
port: 3000
});
// gulp.watch('sass/*.scss', ['sass-watch']);
});
gulp.task('js', function() {
return gulp.src(['./routes/**/*.js', './schemas/*.js', './public/js/*.js']) // 检查文件:js目录下所有的js文件
.pipe(jshint()) // 进行检查
.pipe(jshint.reporter('default')) // 对代码进行报错提示
});
gulp.task('nodemon', function(cb) {
var called = false;
return nodemon({
script: 'app.js'
}).on('start', function() {
if (!called) {
cb();
called = true;
}
});
});
gulp.task('clean', function(cb) {
del(['./dist'], cb)
});
gulp.task('dist', ['js']);
gulp.task('default', ['browser-sync']);