-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (38 loc) · 1.24 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var nodemon = require('gulp-nodemon');
var port = process.env.PORT || 3000;
var jsFiles = ['*.js','src/**/*.js'];
gulp.task('style', function (params) {
console.log('Running the style task.');
return gulp.src(jsFiles)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish', {
verbose: true
}))
.pipe(jscs())
.pipe(jscs.reporter());
});
gulp.task('inject', function () {
var wiredep = require('wiredep').stream;
var inject = require('gulp-inject');
var options = {
bowerJson: require('./bower.json'),
directory: './public/lib',
ignorePath: '../../public'
};
var injectSrc = gulp.src(['./public/css/*.css','./public/js/*.js']);
var injectOptions = {
ignorePath: '/public'
};
return gulp.src('./src/views/*.pug')
.pipe(wiredep(options))
.pipe(inject(injectSrc,injectOptions))
.pipe(gulp.dest('./src/views'));
});
gulp.task('serve',['style','inject'],function () {
return nodemon({delayTime:1,script:'server.js',watch: jsFiles, env: {'PORT': port}}).on('restart',function (ev) {
console.log('restarting....');
});
});