view raw
joemaller joemaller - 10 months ago 91
Node.js Question

Gulp pipe minimal function?

What is smallest function that can be placed in a Gulp pipe and still work?

This doesn't work:

.pipe(function() {
// what's the minimum that can go here and still be a functional pipe?
// what needs to be returned?

Ideally this would be vanilla JS using only the foundational modules Gulp was built on; vinyl, through, etc.


The problem with your pipe is that you're dropping the files of your glob since you don't return them.

Using through2, you can do something like this:

var through = require('through2');

  .pipe(through.obj(function (file, enc, cb) {
    cb(null, file);