Is it mandatory to return gulp.src ()?

I'm confused at gulp.src().

In accordance with this thread, I would suggest that you need to return gulp.src() .

The gulp project examples always return gulp.src(). i.e. gulp input sample .

However, many plugins display documentation that does not return gulp.src(). i.e.: gulp-less or gulp-angular-templatecache

How can I decide whether to return my gulp.src () task?

+4
source share
2 answers

gulp.src, gulp . , . , () , , .

, gulp , , , , , . , .

- . - , gulp, . , .

, , - ; merge-stream:

var merge = require('merge-stream');

gulp.task('task', function () {
    var someOperation = gulp.src('./').pipe(gulp.dest('out'));
    var someOtherOperation = gulp.src('./assets').pipe(gulp.dest('out/assets'));

    return merge(someOperation, someOtherOperation);
});

... , . README, .

+4

, gulp , . , , .

+1

Source: https://habr.com/ru/post/1570067/


All Articles