【问题标题】:Gulp deprecate - how to mark some task as deprecated?Gulp 弃用 - 如何将某些任务标记为弃用?
【发布时间】:2016-06-17 10:32:58
【问题描述】:

是否有任何简单的方法可以将一些 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
});

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

【问题讨论】:

    标签: gulp


    【解决方案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
      }));
    

    【讨论】:

    • 你的调查比我的好:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 2012-03-18
    • 1970-01-01
    • 2014-08-20
    • 2010-09-22
    • 1970-01-01
    相关资源
    最近更新 更多