Created
January 30, 2018 09:55
-
-
Save saboyutaka/4719052b88fb77966a9a56d1885fee1e to your computer and use it in GitHub Desktop.
gulp
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
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']); |
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
{ | |
"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