对具有不同依赖关系的多个文件进行grunt-wiredep [英] grunt-wiredep on multiple files with different dependencies
问题描述
当前的项目结构有点像这样:
The current project structure is somewhat like this:
-index.html
|
-bower.json
|
+-bower_components
建议的项目结构会在项目根。到目前为止,我一直在管理bower.json中的所有前端依赖项,并使用grunt-wiredep任务将其自动包含在index.html中。但是,随着新文件的添加,每个文件都会有不同的依赖项集。
The proposed project structure will add a few more static html files in the project root. Till now I have been managing all the frontend dependencies in bower.json and had it automatically included in index.html using the grunt-wiredep task. But with new files getting added, each file will have different set of dependencies.
-index.html
|
-file-with-some-other-bower-dependency.html
|
-bower.json
|
+bower_components
用不同的鲍尔依赖关系来管理这些文件有效吗?
What would be an efficient way of managing these files with different bower dependencies?
推荐答案
您可以执行两个不同的任务,每个任务都有自己的依赖项(bowerJson):
You can do two different task, each with their own dependencies (bowerJson) :
grunt.initConfig({
wiredep: {
app: {
src: 'index.html',
"bowerJson":{
"dependencies": {
"jquery":"=2.1.3",
...
}
}
},
app2: {
src: 'file-with-some-other-bower-dependency.html',
"bowerJson": {
"dependencies": {
"bootstrap": "~3.0.0",
...
}
}
}}
这篇关于对具有不同依赖关系的多个文件进行grunt-wiredep的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!