How bower works.

When I first looked into Bower, I wasn’t exactly sure how it fit in: it wasn’t just a JavaScript package manager, like Jam, and it wasn’t a module loader, like RequireJS. It calls itself a browser package manager, but what exactly does this mean? How’s that different from a JavaScript package manager? The main difference is that Bower doesn’t just handle JavaScript libraries: it will manage any packages, even if that means HTML, CSS, or images. In this case, a packagemeans any encapsulated, third-party code, usually publicly accessible from a Git repository.

Bower is just a package manager.

The important thing to note here is that Bower is just a package manager, and nothing else. It doesn’t offer the ability to concatenate or minify code, it doesn’t support a module system like AMD: it’s sole purpose is to manage packages.

The bower registry will just be a regular webapp with a simple REST api for name/url.


What is Bower?

Bower is a package manager for client side technologies. It can be used to search , install, uninstall web assets like JavaScript, HTML, and CSS. It is not an opinionated tool and leaves lot of choice to the developers who are using the technology. There are various tools built on top of bower like YeoMan and Grunt. We will talk about them in future posts.

Why should I care?

  1. Saves time : The first reason why should learn about bower is that it will save the time you spend finding client side dependencies. Each time I have to install jQuery I go to the jQuery website and either download the package or use the CDN version. With bower, you can just type a command and you will get jquery installed on your local machine. You don’t have to remember version numbers etc. You can look up any library information using bower info command.
  2. Helps you work offline : Bower creates a .bower folder in the users home directory where it downloads all the assets and keeps them available for offline usage when you install a package. If you are familiar with Java, Bower is similar to the *.m2* repository for the popular Maven build system. Each time you download any repository it will install that library in two folders — one in your application folder and another in the .bower directory under the user’s home directory. Given this, the next time you need this repository it will pick up that version from the user’s home .bower directory.
  3. Makes it easy to express client side dependencies : You can create a file called bower.json where you can specify all your client side dependencies. Anytime you need to figure out what all libraries you are using you can refer to this file.
  4. Makes update easy : Suppose a new version of a library is released with an important security fix, in order to install the new version you just have to run a command and bower will update all of your dependencies with the new version.


A good one explaining bower’s relationship with NPM and version management in NPM, also the possibility of replaceing it with NPM



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s