|
|
5 years ago | |
|---|---|---|
| .. | ||
| lib | 5 years ago | |
| src | 5 years ago | |
| tests | 5 years ago | |
| .npmignore | 5 years ago | |
| .travis.yml | 5 years ago | |
| LICENSE | 5 years ago | |
| Makefile | 5 years ago | |
| README.md | 5 years ago | |
| index.js | 5 years ago | |
| package.json | 5 years ago | |
Easily tap into a pipeline.
Some filters like gulp-coffee process all files. What if you want to process
all JS and Coffee files in a single pipeline. Use tap to filter out .coffee
files and process them through the coffee filter and let JavaScript files
pass through.
gulp.src("src/**/*.{coffee,js}")
.pipe(tap(function(file, t) {
if (path.extname(file.path) === '.coffee') {
return t.through(coffee, []);
}
}))
.pipe(gulp.dest('build'));
What if you want to change content like add a header? No need for a separate filter, just change the content.
tap(function(file) {
file.contents = Buffer.concat([
new Buffer('HEADER'),
file.contents
]);
});
If you do not return a stream, tap forwards your changes.
See Wiki for more examples.
The MIT License (MIT)