Look at the simplest Gulp task that uses gulp-tap:
var gulp = require('gulp');
var tap = require('gulp-tap');
gulp.task('mytask', function () {
return gulp.src("src/*/*.js")
.pipe(tap(function (file) {
file.contents = new Buffer('blabla');
}))
.pipe(gulp.dest('./dist'));
});
It takes files from the src
directory, replaces content with "blabla" and saves those "spoiled" files to the "dist" directory. It's easy!
But what if we have stream instead of the "blabla"? For example:
var gulp = require('gulp');
var tap = require('gulp-tap');
var jsdocParse= require("jsdoc-parse");
gulp.task('jsdoc', function () {
return gulp.src("src/*/*.js")
.pipe(tap(function (file) {
var stream = jsdocParse(file.path);
file.contents = ???;
}))
.pipe(gulp.dest('./dist'));
});
Try this: