Gulp管道功能最小化?

joe*_*ler 9 node.js gulp

什么是最小的功能,可以放在一个Gulp管道,仍然有效?

这不起作用:

gulp.src('**')
  .pipe(function() {
    // what's the minimum that can go here and still be a functional pipe?
    // what needs to be returned? 
  });
Run Code Online (Sandbox Code Playgroud)

理想情况下,这将是仅使用Gulp构建的基础模块的vanilla JS; 乙烯基,通过等

Bal*_*zar 11

管道的问题在于你丢弃了glob的文件,因为你没有返回它们.

使用through2,您可以执行以下操作:

const through = require('through2')

gulp.src('**')
  .pipe(through.obj((file, enc, cb) => cb(null, file)))
Run Code Online (Sandbox Code Playgroud)