Concat scripts in order with Gulp

后端 未结 17 1519
后悔当初
后悔当初 2020-11-28 01:51

Say, for example, you are building a project on Backbone or whatever and you need to load scripts in a certain order, e.g. underscore.js needs to be loaded befo

17条回答
  •  生来不讨喜
    2020-11-28 02:29

    Try stream-series. It works like merge-stream/event-stream.merge() except that instead of interleaving, it appends to the end. It doesn't require you to specify the object mode like streamqueue, so your code comes out cleaner.

    var series = require('stream-series');
    
    gulp.task('minifyInOrder', function() {
        return series(gulp.src('vendor/*'),gulp.src('extra'),gulp.src('house/*'))
            .pipe(concat('a.js'))
            .pipe(uglify())
            .pipe(gulp.dest('dest'))
    });
    

提交回复
热议问题