Created
October 5, 2016 15:27
-
-
Save tibotiber/a5fcc48a2f5a9acee061b0cf0479201f to your computer and use it in GitHub Desktop.
Medium post content (8/8/2016)
This file contains hidden or 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 exec = require('child_process').exec; | |
var gulp = require('gulp'); | |
var runSequence = require('run-sequence'); | |
var bootlint = require('gulp-bootlint'); | |
// Validate html, links, etc. | |
gulp.task('html-proofer', function(done) { | |
execute('htmlproofer ./index.min.html --check-html --check-favicon --check-external-hash', {}, done); | |
}); | |
// Validate bootstrap | |
gulp.task('bootlint', function() { | |
return gulp.src('./index.html.min') | |
.pipe(bootlint({ | |
stoponerror: true | |
})); | |
}); | |
// Full test task | |
gulp.task('test', function(cb) { | |
runSequence('html-proofer', 'bootlint', cb); | |
}); | |
// Util to execute external command | |
function execute(cmd, opts, done) { | |
console.log(cmd); | |
exec(cmd, opts, function(error, stdout, stderr) { | |
console.log(stdout); | |
console.error(stderr); | |
done(error); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment