你可以为个人Grunt任务使用--verbose标志吗?

时间:2015-01-15 01:59:01

标签: gruntjs grunt-cli

这是一个用于“干净”任务的GruntFile示例(使用grunt-contrib-clean插件):

clean: {
            dry: {
                src: ["build/css"],
                options: {
                    'no-write': true
                }
            }
        }

运行grunt clean:dry会输出:

Running "clean:dry" (clean) task
>> 2 paths cleaned.

Done, without errors.

使用grunt clean:dry -v,给我我想要的东西:

Running "clean:dry" (clean) task
Not actually cleaning live/css...
Not actually cleaning live/js...

...但它还显示了一堆与当前任务无关的配置日志。我是否可以使用--verbose标志(或其他内容)来显示任务的完整输出,而无需滚动浏览所有不相关的配置日志?

PS:我的其他插件遇到同样的问题,当他们的文档表明我应该期待更多时,只显示一行输出。

(相关问题:Logging from grunt-contrib-jasmineHow can I force JSHint running in grunt to always use the --verbose flag不回答此问题。)

1 个答案:

答案 0 :(得分:0)

There are some insights into this.

grunt.initConfig({
    verbosity: {
        default: {
            options: { mode: 'dot' }, // normal, oneline, dot, hidden
            tasks: ['groundskeeper', 'requirejs']
        }
    }
grunt.registerTask( '_start',  ['verbosity:default', 'projectInfo'] );