gpt4 book ai didi

gruntjs - 我可以在单个 Grunt 文件中配置多个 jsHint 任务吗?

转载 作者:行者123 更新时间:2023-12-02 10:06:07 25 4
gpt4 key购买 nike

我有一个为 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 hub 文件。我不想这样做,请指导我如何继续?

最佳答案

使用目标:http://gruntjs.com/configuring-tasks#task-configuration-and-targets

grunt.initConfig({
jshint: {
one: {
src: ['files/*'],
options: { /* ... */ }
},
two: {
src: ['files2/*'],
options: { /* ... */ }
}
}
});

关于gruntjs - 我可以在单个 Grunt 文件中配置多个 jsHint 任务吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16526824/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com