I've bower installed some Git repo that I need for my application and I did it by doing the following:
bower install git://github.com/user/cooltool.git --save
grunt bower-install
and then I get the following error:
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.
are Bower components that are installed straight from a GitHub repo always required to be manually added to my index.html
file? if not, how do I make it include the script correctly?
The Grunt tasks are all part of the yo angular-fullstack
scaffolding tool.
The gruntfile's bower-install
task is the following:
// Automatically inject Bower components into the app
'bower-install': {
app: {
html: '<%= yeoman.app %>/views/index.html',
ignorePath: '<%= yeoman.app %>/',
exclude: ['bootstrap-sass']
}
},
Ultimately, I want the script tag for that cooltool bower component to be injected into my index.html
in the Bower build:js section:
<!-- build:js(app) scripts/vendor.js -->
<!-- bower:js -->
<script ...>
<!-- endbower -->
<!-- endbuild -->
After performing running bower install git://github.com/user/cooltool.git --save
, there was a Bower directory created for it, and inside of that directory is a (hidden) .bower.json
file, but not a main bower.json
file:
.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"
}
Typically, you'll install something in this way:
bower cache clean
bower install component --save
However, if the added repo itself does not establish and bower.json rules for main and ignore, you'll need to add it yourself and check that in.
You'd do that in the following way:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With