首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >牙弓-安装一个闪闪发光的保龄球依赖

牙弓-安装一个闪闪发光的保龄球依赖
EN

Stack Overflow用户
提问于 2015-05-04 16:57:12
回答 1查看 252关注 0票数 13

我已经安装了我的应用程序所需的一些Git,并通过以下操作完成了它:

代码语言:javascript
复制
bower install git://github.com/user/cooltool.git --save
grunt bower-install

然后我得到以下错误:

代码语言:javascript
复制
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任务如下:

代码语言:javascript
复制
// Automatically inject Bower components into the app
'bower-install': {
  app: {
    html: '<%= yeoman.app %>/views/index.html',
    ignorePath: '<%= yeoman.app %>/',
    exclude: ['bootstrap-sass']
  }
},

最后,我希望在build:js部分中将这个冷却器bower组件的脚本标记注入我的index.html中:

代码语言:javascript
复制
<!-- 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

代码语言:javascript
复制
{
  "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"
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-14 13:52:51

通常,您将以这样的方式安装一些东西:

代码语言:javascript
复制
bower cache clean
bower install component --save

但是,如果添加的回购本身没有为main和bower.json规则建立和忽略,则需要自己添加并签入。

你这样做的方式如下:

代码语言:javascript
复制
1.- Fork the original repository for the component
2.- Add a bower.json file.
3.- Include in this file a 
    "main": ['path/to/file'], 
    "ignore":['array','of','things','to','ignore']
3.-bower install your forked git repo, and it will work
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30035618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档