Last active
July 11, 2016 18:22
-
-
Save wellingtonpgp/0e8efaed384b9f45379515f906a9c1f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var jshint = require('gulp-jshint'); | |
var jscs = require('gulp-jscs'); | |
var nodemon = require('gulp-nodemon'); | |
var jsFiles = ['*.js', 'src/**/*.js']; | |
gulp.task('style', function () { | |
return gulp.src(jsFiles) | |
.pipe(jshint()) | |
.pipe(jshint.reporter('jshint-stylish',{ | |
verbose: true | |
})) | |
.pipe(jscs()); | |
}); | |
gulp.task('inject', function(){ | |
var wiredep = require('wiredep').stream; | |
var inject = require('gulp-inject'); | |
var injectSrc = gulp.src(['./public/css/*.css', './public/js/*.js'], {read: false}); | |
var injectOptions = { | |
ignorePath: '/public' | |
}; | |
var options = { | |
bowerJson: require('./bower.json'), | |
directory: './public/lib', | |
ignorePath: '../../public' | |
}; | |
//return gulp.src('./src/views/*.jade') | |
//return gulp.src('./src/views/*.ejs') | |
//return gulp.src('./src/views/*.hbs') | |
return gulp.src('./src/views/*.html') | |
.pipe(wiredep(options)) | |
.pipe(inject(injectSrc, injectOptions)) | |
.pipe(gulp.dest('./src/views')); | |
}); | |
gulp.task('serve', ['style', 'inject'], function(){ | |
var options = { | |
script: 'app.js', | |
delayTime: 1, | |
env: { | |
'PORT': 3000 | |
}, | |
watch: jsFiles | |
}; | |
return nodemon(options) | |
.on('restart', function(ev){ | |
console.log('Restarting...'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment