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

后端 未结 10 1238
感情败类
感情败类 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:39

    source: https://github.com/gulpjs/gulp/issues/755

    gulp.start() was never meant to be a public api nor used. And as stated above in comments, the task management is being replaced in the next release....so gulp.start() will be breaking.

    The true intention of the gulp design is to make regular Javascript functions, and only make the task for calling them.

    Example:

    function getJsFiles() {
        var sourcePaths = [
            './app/scripts/**/*.js',
            '!./app/scripts/**/*.spec.js',
            '!./app/scripts/app.js'
        ];
    
        var sources = gulp.src(sourcePaths, { read: false }).pipe(angularFilesort());
    
        return gulp.src('./app/index.html')
            .pipe(injector(sources, { ignorePath: 'app', addRootSlash: false }))
            .pipe(gulp.dest('./app'));
    }  
    

    gulp.task('js', function () {
        jsStream = getJsFiles();
    });
    

提交回复
热议问题