使用参数进行配置

grunt configuring with arguments

我的文件结构如下:

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... 谁能帮助我?

eloibm 的回答很有帮助。 (只需回答即可完成本题。)