Gulp弃用 - 如何将某个任务标记为已弃用?

时间:2016-06-17 10:32:58

标签: gulp

有没有简单的方法可以将某些 gulp 任务标记为已弃用?

gulp.task('task-name', function () {
    console.warn("The `gulp task-name` task is deprecated, it will be removed in next release."); // poore implementation for depreciating some task
});

我想让用户知道,将来某些任务将从包中删除。他们应该为此做好准备。

1 个答案:

答案 0 :(得分:1)

Gulp本身使用deprecated弃用parts of its API。这可能是最接近"官员"你会得到的弃用方式:

var deprecated = require('deprecated');
var gutil = require('gulp-util');

gulp.task('task-name', deprecated.method(
  gutil.colors.yellow('task-name is deprecated'), 
  gutil.log, 
  function() {
    // your task
  }));
相关问题