Merge pull request #210 from cachethq/jshint-gulp

Closes #207 - Adds JSHint
This commit is contained in:
James Brooks 2015-01-01 18:13:16 +00:00
commit 335738dc40
2 changed files with 19 additions and 2 deletions

View File

@ -1,20 +1,20 @@
var elixir = require('laravel-elixir');
var gulp = require('gulp');
var changed = require('gulp-changed');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
/**
* Custom Elixir job for copying images, but only if they're newer.
*/
elixir.extend('images', function() {
gulp.task('copy-images', function() {
console.log('Copying jQuery Map.');
gulp.src('app/assets/bower_components/jquery/dist/jquery.min.map')
.pipe(changed('public/build/js/jquery.min.map', {
hasChanged: changed.compareSha1Digest
}))
.pipe(gulp.dest('public/build/js'));
console.log('Copying Ionicons.');
gulp.src('app/assets/bower_components/ionicons/fonts/**')
.pipe(changed('public/build/fonts/ionicons', {
hasChanged: changed.compareSha1Digest
@ -25,6 +25,20 @@ elixir.extend('images', function() {
return this.queueTask('copy-images');
});
/**
* Run JSHint on our JavaScript sources.
*/
elixir.extend('jshint', function() {
gulp.task('jshint', function() {
gulp.src('app/assets/js/**')
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'));
});
return this.queueTask('jshint');
});
elixir(function (mix) {
mix.sass('app/assets/sass/main.scss')
.styles([
@ -45,6 +59,7 @@ elixir(function (mix) {
'js/app.js',
'js/**/*.js',
], './app/assets/')
.jshint()
.images()
.version(['public/css/all.css', 'public/js/all.js']);
});

View File

@ -2,6 +2,8 @@
"devDependencies": {
"gulp": "^3.8.8",
"gulp-changed": "1.1.0",
"gulp-jshint": "1.9.0",
"jshint-stylish": "1.0.0",
"laravel-elixir": "*"
}
}