Search code examples
node.jsgulp

What gulp.src() → gulp.dest() returns and why it works in gulp#4.x?


According gulp#4.x documentation, gulp task must return the one of the following:

  • stream
  • promise
  • callback function
  • child process
  • RxJS Observable

However, the following task working without error:

gulp.task('test', () => {
    return gulp.src('source/**/*.*')
            .pipe(gulp.dest('dest'));
});

But what of the above ones it returns?


Solution

  • From the docs, gulp.src:

    Returns a stream of Vinyl files that can be piped to plugins.

    And gulp.dest:

    ...will write files [and]... Re-emits all data passed to it so you can pipe to multiple folders