gulp.run is deprecated. How do I compose tasks?

后端 未结 10 1276
感情败类
感情败类 2020-12-22 18:57

Here is a composed task I don\'t know how to replace it with task dependencies.

...
gulp.task(\'watch\', function () {
 var server = function(){
  gulp.run(\         


        
10条回答
  •  误落风尘
    2020-12-22 19:36

    To run a task before starting to watch, instead of using gulp.run() or gulp.start() just run the gulp command straight up.

    So instead of:

    var compress = function () {
        return gulp.src('js/vendor/*.js')
            .pipe(concat('vendor.js'))
            .pipe(gulp.dest('./build/js/'));
    };
    

    Just do:

    gulp.src('js/vendor/*.js')
            .pipe(concat('vendor.js'))
            .pipe(gulp.dest('./build/js/'));
    

    Or you can wrap that latter code in a "normal" function and call it whenever you want.

    -- Inspired by this answer from a similar thread.

提交回复
热议问题