Bower is a package manager for the web.
Go to http://nodejs.org/ and download the installer.
Then to verify that NodeJS is installed, write the following:
$ node -v
$ npm install -g bower
$ bower install jquery
Install a specific version:
$ bower install jquery#1.9.1
$ bower list
$ bower list --paths
Then you can add the JS file with the path to the HTML code.
$ bower uninstall jquery
If you find a repo that doesn't appear at Bower, you can use a github url:
$ bower install <github_url>
This is to define which dependencies JS libraries the project has. If you already installed some packages to the project, Bower adds them to the file for you.
$ bower init
With this, you can add a .gitignore file, where it ignores the "bower_components" folder when you commit to the git repo. It saves some space.
If you checkout the repo and want to download the JS libraries, all you have to do is:
$ bower install
If you want to add a new package, and want to be at the json file, you have to do it in the following way (add at the end -S
):
$ bower install jquery -S
# or
$ bower install --save jquery
Bower can also install CSS libraries, not only JS libraries.
$ bower install bootstrap