joemaller joemaller - 1 year ago 173
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.

Answer Source

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download