Closed tomgenoni closed 8 years ago
Something we could add is allowing the src
parameter of the template object taking a function that has the file in the callback, however the library is on the verge of having too many fancy options like this. I suggest using something like gulp-tap
to handle this:
var gulp = require('gulp');
var wrap = require('gulp-wrap');
var frontMatter = require('gulp-front-matter');
var tap = require('gulp-tap');
gulp.task('wrap', function () {
gulp.src(srcPattern)
.pipe(frontMatter({
property: 'data'
}))
.pipe(tap(function(file, t) {
// you could optionally pass this into a gulp.src with a custom dest
// and return the stream to prevent it from using the original dest
t.through(wrap, [{ src: file.data.src }]);
}))
.pipe(gulp.dest(dest));
});
The following is incorrect but illustrates what I'm trying to do: pull the value set for
template
in each of the source file's front matter and pass itsrc
of the wrap. Is this doable?