How to get task name inside task in gulp

后端 未结 5 1160
误落风尘
误落风尘 2021-02-12 09:46

I\'m using gulp-plumber + gulp-notify and want to put task name in gulp-notify as a title. following is the code i wrote, thanks in advance.

gulp.task(\'SOMETASK         


        
5条回答
  •  爱一瞬间的悲伤
    2021-02-12 10:19

    gulp.Gulp.prototype.__runTask = gulp.Gulp.prototype._runTask;
    gulp.Gulp.prototype._runTask = function(task) {
      this.currentTask = task;
      this.__runTask(task);
    }
    
    gulp.task("someTask", function(){
      console.log( this.currentTask.name );
    }
    

提交回复
热议问题