Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gulp
const gulp = require('gulp');
const browserSync = require('browser-sync');
const plumber = require('gulp-plumber');
const htmlhint = require('gulp-htmlhint');
const reload = browserSync.reload;
gulp.task('browser-sync', function () {
browserSync({
server: {
baseDir: './public'
},
open: 'external'
});
});
gulp.task('html', function () {
return gulp.src('./public/**/*.html')
.pipe(plumber())
.pipe(htmlhint())
.pipe(htmlhint.reporter())
.pipe(htmlhint.failReporter())
});
gulp.task('watch', function () {
gulp.watch(['./public/**/*.html'], ['html', reload]);
gulp.watch('./public/css/**').on("change", reload);
gulp.watch('./public/js/**').on("change", reload);
});
gulp.task('default', ['html', 'browser-sync', 'watch']);
{
"private": true,
"scripts": {
"gulp": "gulp"
},
"dependencies": {
"browser-sync": "^2.18.12",
"gulp": "^3.9.1",
"gulp-cached": "^1.1.1",
"gulp-html-beautify": "^1.0.1",
"gulp-htmlhint": "^0.3.1",
"gulp-plumber": "^1.1.0",
"gulp-stylefmt": "^1.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.