admin管理员组

文章数量:1317909

For example I have a task with next content:

function task() {
    gulp.src('libs/*.js')
        // some manipulations
        .concat('libs.js')

    gulp.src('js/*.js')
        // Another manipulations
        .concat('app.js')
}

What if I don't want to put this files anywhere in file system? Can I somehow concatenate libs.js and app.js inside a task?

For example I have a task with next content:

function task() {
    gulp.src('libs/*.js')
        // some manipulations
        .concat('libs.js')

    gulp.src('js/*.js')
        // Another manipulations
        .concat('app.js')
}

What if I don't want to put this files anywhere in file system? Can I somehow concatenate libs.js and app.js inside a task?

Share Improve this question asked Mar 7, 2016 at 8:48 aciderntacidernt 2,3113 gold badges21 silver badges36 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 8

You can use merge-stream package. Simple example:

gulp.task("do-something", function() {
    var vendorScripts1 = gulp.src("libs/*.js")
        .pipe(/* I want to do something*/));

    var vendorScripts2 = gulp.src("js/*.js")
        .pipe(/* I want to do something else here*/);

    return merge(vendorScripts1 , vendorScripts2)
      .pipe(/*bla bla bla*/);
});

Github example I hope it will help you.

Thanks

本文标签: javascriptHow to concatenate two streams using gulpStack Overflow