06 April 2014
Bower - a UI dependency management tool
There are several popular build tools nowadays to manage project dependencies, like maven and others. But UI related dependencies aren't managed very well under these tools.
Bower is a lightweight UI related dependency manager tool, it depends on Node.js to run and npm as package manager
Bower depends on Node and npm. It's installed globally using npm:
Also make sure that git is installed as some bower packages require it to be fetched and installed.
Creating your project's bower.json file
Configure your project's dependency in a file called bower.json, the default bower configuration file for your project:
. name and version: Here you place your project name and version.
. ignore: Here we're telling Bower that it should ignore folders like "node_modules" "tests" and "bower_components" since these folders are used for development and test scenarios and are not needed during production deployment or application runtime.
. devDependencies: Here we're listing our development dependencies, which are a list of other bower packages available for download, like jQuery, requireJS and angularJS libs. Notice the >= symbol, this will tell Bower to fetch version "XXX" or above of this particular artifact. There are other options as well to fetch isolated version ranges.
After that we run the command
and Bower will fetch our necessary dependencies and place them under "bower_components" folder as per default.
The .bowerrc file enables custom configuration for Bower. For example we can determine a custom install directory: