我为2个不同的模块配置了一个grunt文件。在一个单一的任务,我可以给多个来源,它都工作得很好。现在我的要求是为两个模块提供不同的选项-我想要两个模块的不同JsHint规则,我想要两个项目都有单独的最小化文件和一个共同的最小化文件。
Gruntfile.js ->
jshint: {
ac:{
options: {
laxcomma: true, // maybe we should turn this on? Why do we have these
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
onevar: true
},
source: {
src: ['module1/*.js']
}
},
lib:{
options: {
laxcomma: true, // maybe we should turn this on? Why do we have these
curly: true,
eqeqeq: true,
immed: true,
latedef: true
},
source: {
src: ['module2/*.js']
}
}
}
我看到了一些堆栈溢出的问题,但我只能找到grunt -hub作为一个选项,我需要创建2个单独的文件,然后一个grunt枢纽文件。我不想那样做,请指导我如何进行?
使用目标:http://gruntjs.com/configuring-tasks#task-configuration-and-targets
grunt.initConfig({
jshint: {
one: {
src: ['files/*'],
options: { /* ... */ }
},
two: {
src: ['files2/*'],
options: { /* ... */ }
}
}
});