1
我有這樣的文件結構:咕嚕配置與參數
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 serve
後,我會得到
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 serve:mobile_a
,它仍然編譯既mobile_a和mobile_b ...誰能幫助我?
你可以像''grunt.option('argument_name_1')''獲得參數,並稱它們爲'grunt ... --argument_name_1 = string_example' – eloibm
@eloibm謝謝,它是有幫助的。 – Kreja