【发布时间】:2015-05-04 16:57:12
【问题描述】:
我已经为我的应用程序安装了一些 Git 存储库,我通过执行以下操作完成了它:
bower install git://github.com/user/cooltool.git --save
grunt bower-install
然后我得到以下错误:
cooltool was not injected in your file.
Please go take a look in "app/bower_components/cooltool" for the file you need, then manually include it in your file.
直接从 GitHub 存储库安装的 Bower 组件是否总是需要手动添加到我的 index.html 文件中?如果没有,如何让它正确包含脚本?
Grunt 任务都是yo angular-fullstack 脚手架工具的一部分。
gruntfile 的bower-install 任务如下:
// Automatically inject Bower components into the app
'bower-install': {
app: {
html: '<%= yeoman.app %>/views/index.html',
ignorePath: '<%= yeoman.app %>/',
exclude: ['bootstrap-sass']
}
},
最终,我希望将该cooltool bower 组件的脚本标签注入到我的index.html 中的Bower build:js 部分:
<!-- build:js(app) scripts/vendor.js -->
<!-- bower:js -->
<script ...>
<!-- endbower -->
<!-- endbuild -->
执行运行bower install git://github.com/user/cooltool.git --save 后,为其创建了一个 Bower 目录,该目录内部是一个(隐藏的).bower.json 文件,但不是主要的bower.json 文件:
.bower.json:
{
"name": "d3-cloud",
"homepage": "https://github.com/jasondavies/d3-cloud",
"version": "1.0.5",
"_release": "1.0.5",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "83eb4128335eacdc0736ab7a6cafbdc2b124f484"
},
"_source": "https://github.com/jasondavies/d3-cloud.git",
"_target": "~1.0.5",
"_originalSource": "https://github.com/jasondavies/d3-cloud.git"
}
【问题讨论】:
-
你能在你的 Gruntfile 中显示
bower-install任务的代码/配置吗? -
已更新。很奇怪,我不确定 bower-install 如何负责将脚本标签注入 build:js / vendor / bower 标签
-
cooltool 库到底是什么?
-
你能给我们看看cooltool的bower.json吗?
-
@MaartenBicknese 我已经用
.bower.json的内容更新了问题(注意它不是主要的bower.json,没有一个
标签: node.js gruntjs yeoman bower bower-install