Manipulate DOM with jsdom@latest
npm install gulp-jsdom
const { src, dest } = require("gulp");
const dom = require("gulp-jsdom");
function html() {
return src("./src/index.html")
.pipe(dom(document => {
document.body.innerHTML = "Hello!";
}))
.pipe(dest("./public/"));
}
const gulp = require("gulp");
const dom = require("gulp-jsdom");
gulp.task("html", function () {
return gulp.src("./src/index.html")
.pipe(dom(function(document){
document.body.innerHTML = "Hello!";
}))
.pipe(gulp.dest("./public/"));
});
// ...
.pipe(dom(function(document, window){
document;
window;
this.filename; // current filename
this.file; // current file buffer
}), {
/* jsdom options here */
}, false) // serialize off
Type: Function
Manipulate DOM here! >:D
Type: Object
Default: {}
jsdom options read more
Type: Boolean
Default: true