Skip to content

Instantly share code, notes, and snippets.

@christian-acuna
Created August 14, 2016 09:05
Show Gist options
  • Save christian-acuna/d604da5a1791b87462ab37871d5fb0e1 to your computer and use it in GitHub Desktop.
Save christian-acuna/d604da5a1791b87462ab37871d5fb0e1 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var args = require('yargs').argv;
var config = require('./gulp.config')(); //require and execute it
var $ = require('gulp-load-plugins')({lazy: true});
var paths = {
js : ['*.js', 'src/**/*.js']
};
gulp.task('vet', function() {
log('Analyzing source with JSHint and JSCS');
return gulp
.src(config.alljs)
.pipe($.if(args.verbose, $.print()))
.pipe($.jscs())
.pipe($.jscs.reporter())
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish', {
verbose: true
}))
.pipe($.jshint.reporter('fail'));
});
////////////
function log(msg) {
if (typeof(msg) === 'object') {
for (var item in msg) {
if (msg.hasOwnProperty(item)) {
$.util.log($.util.colors.blue(msg[item]));
}
}
} else {
$.util.log($.util.colors.blue(msg));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment