Created
May 7, 2023 18:19
-
-
Save himanshurajora/af3e6e91c908589fbf9e4251f843af26 to your computer and use it in GitHub Desktop.
GulpJs html live compile and host
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 comments = require("gulp-header-comment"); | |
const fileInclude = require("gulp-file-include"); | |
const bs = require("browser-sync"); | |
const path = { | |
src: { | |
html: "src/**/*.html", | |
}, | |
}; | |
gulp.task("html", () => { | |
return gulp | |
.src(path.src.html) | |
.pipe( | |
fileInclude({ | |
basepath: "src/partial", | |
}) | |
) | |
.pipe(comments(`Website by Vedik Devs`)) | |
.pipe(gulp.dest("./output")); | |
}); | |
gulp.task("watch:html", function () { | |
gulp.watch(["src/**/*.html", "src/**/*.html"], gulp.series("html")); | |
}); | |
gulp.task( | |
"default", | |
gulp.series( | |
"html", | |
gulp.parallel("watch:html", function () { | |
bs.init({ | |
server: "output/", | |
}); | |
}) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment