I'm trying to setup a Gulp task to convert .ttf fonts to webfont formats, by using gulp-ttf2woff and gulp-ttf2woff2 plugins. The respectively convert the source fonts to .woff and .woff2.
I've come out with these two separate functions, one for each plugin:
function fontsW(done) {
src(fontsSrc)
.pipe(ttf2woff())
.pipe(dest(fontsDist))
done();
};
function fontsW2(done) {
src(fontsSrc)
.pipe(ttf2woff2())
.pipe(dest(fontsDist))
done();
};
Is it possible to condensate them in a single function, let's call it function fonts(done) {} that takes care of both plugins at once?
Basically, I'd like to have something like this
function fontsW2(done) {
src(fontsSrc)
.pipe(ttf2woff())
.pipe(ttf2woff2())
.pipe(dest(fontsDist))
done();
};
where both ttf2woff() and ttf2woff2() receive the output of src and give their own processed files to dest.
You can do this: