1.1.0 • Published 5 years ago

gulp-jsdom v1.1.0

Weekly downloads
73
License
MIT
Repository
github
Last release
5 years ago

gulp-jsdom

npm.io npm.io npm.io

Manipulate DOM with jsdom@latest

Installation

npm install gulp-jsdom

Simple Example (gulp 4.0.2)

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/"));
}

Simple Example (gulp 3.9.1)

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/"));
});

More Features

// ...
.pipe(dom(function(document, window){
	
	document;
	window;
	
	this.filename; // current filename
	this.file; // current file buffer
	
}), { 
	/* jsdom options here */
}, false) // serialize off

API

dom(mutator , options, serialize)

mutator

Type: Function

Manipulate DOM here! >:D

options

Type: Object Default: {}

jsdom options read more

serialize

Type: Boolean Default: true

More information about serialize

Thank you

1.1.0

5 years ago

1.0.1

6 years ago

1.0.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago