Gruntjs grunt wiredep在具有不同依赖关系的多个文件上运行
当前的项目结构有点像这样:Gruntjs grunt wiredep在具有不同依赖关系的多个文件上运行,gruntjs,bower,wiredep,grunt-wiredep,Gruntjs,Bower,Wiredep,Grunt Wiredep,当前的项目结构有点像这样: -index.html | -bower.json | +-bower_components 建议的项目结构将在项目根目录中添加更多的静态html文件。到目前为止,我一直在管理bower.json中的所有前端依赖项,并使用grunt wiredep任务将其自动包含在index.html中。但是,随着新文件的添加,每个文件将具有不同的依赖项集 -index.html | -file-with-some-other-bower-dependency.html | -bo
-index.html
|
-bower.json
|
+-bower_components
建议的项目结构将在项目根目录中添加更多的静态html文件。到目前为止,我一直在管理bower.json中的所有前端依赖项,并使用grunt wiredep任务将其自动包含在index.html中。但是,随着新文件的添加,每个文件将具有不同的依赖项集
-index.html
|
-file-with-some-other-bower-dependency.html
|
-bower.json
|
+bower_components
管理这些具有不同bower依赖项的文件的有效方法是什么?您可以执行两个不同的任务,每个任务都有各自的依赖项(bowerJson):
grunt wiredep添加对包的
main
属性中列出的文件的引用。它会扫描您提到的文件并自动添加这些依赖项。我不认为你想要实现的是angularjs的项目?
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",
...
}
}
}}