【问题标题】:Run all Grunt SubTasks except one运行除一个之外的所有 Grunt 子任务
【发布时间】:2014-06-03 05:43:33
【问题描述】:

我有一堆用于 grunt watch 的子任务(例如 grunt watch:styles、grunt watch:sprites 等)。然后许多其他任务运行grunt watch。我想排除一项任务。有没有办法指定?基本上运行除grunt watch:dist 之外的所有grunt watch 子任务。

我知道我可以创建另一个任务并且只指定我真正感兴趣的子任务,但是,如果我稍后添加另一个子任务,这意味着我现在必须添加它,所以我宁愿不这样做.

谢谢

【问题讨论】:

    标签: gruntjs grunt-contrib-watch


    【解决方案1】:

    可能有更好的方法,但现在这可以解决问题:

    grunt.registerTask('watch:basic', function () {
        delete grunt.config.data.watch.dist;
        grunt.task.run('watch');
    });
    

    幸运的是,在这种情况下,我没有其他可能运行grunt watch:dist 的任务,因此简单地删除配置是安全的,但我可以想到这种方法会产生冲突的其他情况。

    【讨论】:

    • 这就是它为我工作的方式:delete grunt.config.data.watch.dist;
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多