How to use Bower

Install Bower

You can install Bower through NPM also the Github repository offers a install and usage guide. If you want to install bower startup your CLI and use the following command.

npm install -g bower

Initialize Bower

After installation you can generate a bower.json manifest file to define your packages by using the following command.

bower init

If you open your bower.json file it should look like this.

{

"name": "example bower.json file",

"version": "0.0.1",

"authors": [

"Dennis Bruijn <0x1ad2>"

],

"description": "An example project",

"license": "MIT",

"ignore": [

"**/.*",

"node_modules",

"bower_components",

"test",

"tests"

],

"dependencies": {

"animate.css": "~3.4.0",

"bootstrap": "~3.3.5",

"font-awesome": "fontawesome#~4.4.0"

}

}

Install a Bower package

As I mentioned earlier Bower packages are front-end projects You can find a list of Bower packages in the Bower packages registry

To install a package use the following command.

bower install your-package-name

When you install a package the bower_components directory will appear in the root of your project. Also you can use use — save to persist the packages in your projects

Stay up to date

You can update all bower packages using a single command:

bower update

the packages will be updated to their newest version according to the bower.json file.