Skip to content

Instantly share code, notes, and snippets.

@ckjoris
Created August 6, 2014 23:52
Show Gist options
  • Save ckjoris/5e171b8e832681e293bd to your computer and use it in GitHub Desktop.
Save ckjoris/5e171b8e832681e293bd to your computer and use it in GitHub Desktop.
gulp-jsvalidate with git hook
var gulp = require('gulp');
var jsValidate = require('gulp-jsvalidate');
gulp.task('default', function() {
// check for js syntax errors
return gulp.src('web/app/**/*.js')
.pipe(jsValidate());
});
#!/bin/bash
set -e
function run_test {
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
head="HEAD"
else
# First commit, use an empty tree
head="4b825dc642cb6eb9a060e54bf8d69288fbee4904"
fi
gulp
if [[ "$?" != "0" ]]; then
echo "gulp exited with error, aborting commit."
exit 1
fi
}
case "${1}" in
--about )
echo "run gulpfile"
;;
* )
run_test
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment