Bower is a client-side or browser package manager. It will handle your 3rd-party packages that are registered with the service. To make it more useful, you can package up some of your own code and create a component to install with Bower.
Prepare your Package
To prepare your code to be a Bower package, you must install the Bower CLI:
If you haven’t upgraded Bower lately, you might want to, as the basic config files have changed recently, and the CLI has improved. This command would do the trick:
Now let’s generate the basic config file,
bower.json, by running:
You will be prompted to select a name, version, etc. for your project.
Add Your Package to the Registry
There is a Bower registry at
http://bower.herokuapp.com that is used as a central lookup for the Bower components that are available. This allows searching for packages by name, for instance:
Now the only step left is to add a reference to our package in the registry, for instance:
That’s it! It’s that easy.
When giving a URL to your git repo, use the
git protocol URL specifically. Otherwise on old versions of Bower you’ll get an error:
The newer versions will give a much more helpful message:
And don’t worry about name overwriting. Bower will catch that too with an error response: