Package management with Bower

We will now install the various components that make up our client, namely Handlebars.js, Backbone.js, and Twitter Bootstrap Version 2 using Bower.

Bower is a package manager for the web. A Bower package can contain assets of different types, such as CSS, JavaScript, and images. Let's install Bower globally with the following command:

npm install -g bower

In Bower, dependencies are listed in a bower.json file, similar to Node's package.json. Let's create a ./bower.json file and define our client-side dependencies:

{
  "name": "vision",
  "version": "0.0.1",
  "dependencies": {
    "json2": "*",
    "jquery": "*",
    "underscore": "*",
    "backbone": "*",
    "handlebars": "*",
    "bootstrap": "2.3.2"
  }
}

Now create the following Bower configuration ...

Get Advanced Express Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.