Closed psalaets closed 9 years ago
Here's my attempt at making gulp-dom-src writeable for #2.
I added a "duplex" function to domSrc which is where the write/read stream comes from. The existing cheerio code was reusable.
After scanning the html for script/style references, it reads them one by one using vinyl-file with async and sends them down the stream.
A really basic usage example:
var gulp = require('gulp'); var domSrc = require('gulp-dom-src'); var concat = require('gulp-concat'); gulp.task('go', function() { return gulp.src('index.html') .pipe(domSrc.duplex({ selector: 'script', attribute: 'src' })) .pipe(concat('bundle.js')) .pipe(gulp.dest('build/')); });
Great pull request. Thanks!
Here's my attempt at making gulp-dom-src writeable for #2.
I added a "duplex" function to domSrc which is where the write/read stream comes from. The existing cheerio code was reusable.
After scanning the html for script/style references, it reads them one by one using vinyl-file with async and sends them down the stream.
A really basic usage example: