grunt.option
还可以在task中使用,如下:
grunt.registerTask('upload', 'Upload code to specified target.', function(n) {
var target = grunt.option('target');
// do something useful with target here
});
grunt.registerTask('deploy', ['validate', 'upload']);
注意,boolean参数可以仅指定key,而省略value。例如,在命令行执行 grunt deploy --staging
将会使grunt.option('staging')
返回 true
。
grunt.option
获取或设置一个选项。
grunt.option(key[, val])
boolean类型的选项可以通过在 key
前添加 no-
来取消。案例如下:
grunt.option('staging', false);
var isDev = grunt.option('no-staging');
// isDev === true
grunt.option.init
初始化 grunt.option
。如果省略 initObject
,option将被初始化为一个空对象,否则将被设置为initObject
。
grunt.option.init([initObject])
grunt.option.flags
将所有参数作为命令行参数数组返回。
grunt.option.flags()
标签:Grunt
相关阅读 >>
更多相关阅读请进入《Grunt》频道 >>
![]()
书籍 Vue.js 设计与实现 基于Vue.js 3 深入解析Vue.js 设计细节
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
相关推荐
评论
管理员已关闭评论功能...