Gruntjs 用参数配置grunt
我的文件结构如下:Gruntjs 用参数配置grunt,gruntjs,Gruntjs,我的文件结构如下: app mobile_a mobile_b mods 我用 var appConfig = { dist: 'build', programWildcard: 'mobile_*', }; ... grunt.registerTask('serve', [ 'replace:version', 'clean:server', 'concurrent:server', 'underscore_jst',
app
mobile_a
mobile_b
mods
我用
var appConfig = {
dist: 'build',
programWildcard: 'mobile_*',
};
...
grunt.registerTask('serve', [
'replace:version',
'clean:server',
'concurrent:server',
'underscore_jst',
'replace:cmdWrap',
'connect:livereload',
'watch'
]);
在我运行grunt service
之后,我将获得
app
build
mobile_a
mobile_b
mobile_a
mobile_b
mods
但现在,我只想在mobile_a中编译文件并获得:
app
build
mobile_a
mobile_a
mobile_b
mods
所以我写了这个:
grunt.registerTask('serve', 'Compile and start a connect web server', function(target) {
appConfig.programWildcard = target;
return grunt.task.run([
'replace:version',
'clean:server',
'concurrent:server',
'underscore_jst',
'replace:cmdWrap',
'connect:livereload',
'watch'
]);
});
但当我运行
grunt-service:mobile\u a
时,它仍然编译mobile\u a和mobile\u b。。。有人能帮我吗 IBM的anwser很有帮助。(回答完这个问题即可。)IBM的anwser很有帮助。(回答完这个问题即可。)你可以得到像grunt.option('argument\u name\u 1')这样的参数,然后像grunt一样调用它们--argument\u name\u 1=string\u示例
@eloibm谢谢,它很有帮助。您可以获取类似grunt.option('argument\u name\u 1')的参数
,并像grunt那样调用它们--参数\u name\u 1=string\u示例
@elo谢谢,这很有帮助。