0.0.6 • Published 7 years ago

gulp-html-takeout v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

gulp-html-takeout

This is the Gulp plugin which extracts only the part specified by CSS selector. (CSSセレクターで指定した部分のみを取り出すGulpプラグインです。)

install

npm install --save-dev gulp-html-takeout

Example

gulpfile.js

var gulp    = require("gulp");
var takeout = require("gulp-html-takeout");
var concat  = require("gulp-concat");

gulp.task('default',function(){
	return gulp.src(['sample/*.html'])
		.pipe(takeout('h1'))
		.pipe(concat('bundle.html'))
		.pipe(gulp.dest('dist/'));
});

sample/hello.html

<h1>Hello</h1>

sample/world.html

<h1>World</h1>

dist/bundle.html

Hello
World

API

takeout(option)

option

Set CSS Seletor. If not specified, "body" is the default.

   // == "body"
   .pipe(takeout())
   
   // HTML element
   .pipe(takeout("html"))
   .pipe(takeout("head"))
   .pipe(takeout("h1"))
   
   //Class and ID
   .pipe(takeout(".foo"))
   .pipe(takeout("#bar"))

If more than one HTML Element is applicable

gulp.task('default',function(){
	return gulp.src(['sample/*.html'])
		.pipe(takeout('h1'))
		.pipe(concat('bundle.html'))
		.pipe(gulp.dest('dist/'));
});

sample/foo.html

<h1>Hello</h1>
<h1>World</h1>

dist/bundle.html

HelloWorld

License

MIT License

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago