grunt bower安装一个shimmed凉亭依赖
我已经安装了一些我的应用程序需要的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仓库直接安装的鲍尔组件总是需要手动添加到我的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
,为它创build了一个Bower目录,该目录内部是(隐藏的) .bower.json
文件,但不是main 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" }
通常情况下,你将以这种方式安装一些东西:
bower cache clean bower install component --save
但是,如果添加的回购本身没有为main和bower.json规则build立并忽略,则需要自己添加并检查。
你可以这样做:
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