I initialized a bower project under d:\myProject and if i run bower install angularjs the packages are copy in the same folder. But what i need to do is to copy the packages under d:\myprojects\src\resources\static. How can i do that?
Bower's docs tell you that adding the "directory" tag in your .bowerrc file will make bower put downloaded packages in that dir.
notice that the path is relative to where you have the project's json so in your case:
{
"directory": "src/resources/static/"
...
}
Also see this answer and this one.
I am having trouble installing files with the appropriate name folder and sub folder. Bower 1.4.1
In project root directory. I've added .bowerrc
{ "directory": "public/lib" }
When I run "bower install angular", the files are being added to the default folder bower_components. I've already tried removing bower and installing it. I've already looked into the bower configuration page. I can't seem to get it to work the way I want it to. Any solutions to my problem?
I am trying to use Bower to install jquery.
The frustrating problem I have been running into is that bower downloads the entire repro. I was hoping to tell bower to install a certain version of jquery and have only those files downloaded.
I did try the suggestion here with no luck. The entire repo is still downloaded even after clearing the bower cache
I would rather have something else manage which files to download than me manually specifying the file names in bower.json
bower.json in the repo : https://github.com/jquery/jquery/blob/master/bower.json
Thank you
I think you didn't unterstand the meening of bower:
Bower is handling you dependencys, so if you do a:
bower install jquery
it should download all files.
Now to you question:
you have following options:
declare wich file you want to download:
bower install http://code.jquery.com/jquery-2.1.0.min.js
but remember:
this file cant be updated easily
search for a js only package:
expample with bootstrap:
bower install bootstrap-css-only
but remember:
these packages sometimes are not up to date
use bower-installer (recommended):
install the bower-installer:
npm install bower-installer --global
and now follow the tutorial:
bower-installer github
sorry for my bad english :-)
I'm figuring out how to install packages using bower.
When I 'bower install packagename', packages are installed in /app/components/.
However, I'd like to dictate the structure of my projects myself.
Is there a way to configure bower to install packages in particular places?
Bower can be configured using JSON in a .bowerrc file.
The directory setting is the path in which installed components should be saved.
If not specified it will be install in the default path.
So for example :
{
"directory" : "package/components",
"json" : "bower.json"
}
Here we tell bower to install packages in the subfolder package/components, and use a file named bower.json to store its data.
I have a very small repo in which I do all dev work in the master branch and use tags as "stable" points in history.
I guess by default Bower seems to fetch the latest tagged version of a repo. I'm trying to get the most recent commit in the master branch.
I've tried running all these, in every conceivable order:
bower cache-clean mypackage
bower install mypackage --force-latest
bower install mypackage --force --force-latest
bower install mypackage --force
I've also tried adding latest to my bower.json file:
"dependencies": {
"mypackage": "latest"
}
And then running:
bower update mypackage
No matter what it seems to always get the latest tagged state.
How do I get the latest, most up-to-date, untagged state of the project?
Specify a git commit SHA instead of a version:
bower install '<git-url>#<git-commit-sha>'
Example:
bower install 'git://github.com/yeoman/stringify-object.git#d2895fb97d'
You can also specify a branch instead of a SHA, but that's generally not recommended unless it's in development and you control all the parts.
Yes, you can point to the git url, or use name/repo shorthand (for github repos):
bower.json
{
"name": "bower-test",
"dependencies": {
"dpm": "git#github.com:okfn/dpm.git",
"docker-nmpjs": "terinjokes/docker-npmjs"
}
}
More in the docs
As #roi noted in the comments, you can use the --save flag to automatically add dependencies to bower.json, e.g. bower install terinjokes/docker-npmjs --save
You can install a branch in Bower > 1.0.0:
bower install xxx#foo-branch
More details at https://github.com/bower/bower/issues/107#issuecomment-22352689.
If you are using a bower.json file you specify the latest version of a branch with a line in either the dependencies or devDependencies as appropriate for your project configuration:
"angular-bootstrap": "git#github.com:angular-ui/bootstrap.git#bootstrap3",
Then when you run bower install the latest version of that branch is installed. That would be branch bootstrap3 of angular-ui in this example.
bower install --save package-name#master
adds this:
"dependencies": {
"package-name": "master"
}
using bower.json:
"dependencies": {
"jquery.slimscroll": "latest",
"jQuery": "1.11",
"fullPage.js": "git#github.com:overbyte/fullPage.js.git#1d6bbac3d4c3b1d3d7d4096cdbcabd1c3914393f",
}
where
"[library name - in this case a forked version of fullpage.js]" : "[from git clone box in github][#commit number if required - without this you will get latest tagged version]"