What is this
• Client side package Manager
• Great tool to manage all you web dependencies like JavaScript
libraries
What can be done from Bower
• Web sites are made of lots of things — frameworks, libraries, assets,
utilities, and rainbows. Bower manages all these things for you.
# registered package
$ bower install jquery
# GitHub shorthand – download repository SOQLBuilder from user Jitendra
$ bower install JitendraZaa/SOQLBuilder
# Git endpoint
$ bower install git://github.com/user/package.git
# URL
$ bower install http://example.com/script.js
How to Install it
• I am taking an example of Node
• To install in bower in node globally
• $ npm install –g bower
• Above command will install bower and can be used from anywhere
Benefit
• Let’s say you want to use some library like “polymer” or “Jquery”
• Previously,
• search latest version of polymer / JQuery
• Download zip file, extract and save in your folder
• If that library has dependency on other then download that library also manually
• After some day, your locally saved library is out of date
• With Bower
• Simply run this commands in your folder
• $ bower install --save Polymer/polymer /*This will download latest version*/
Bower init and bower.json
• If you have completed development of your application and want to
distribute it, lets say from Git. Use below command
$ bower init
• This command will ask some questions and will create bower.json file
• While pushing on Git, do not push bower folder, push only bower.json
• Users can install all dependency of your package by running command
$ bower install
Don’t forget
• If you add new dependency after bower.json is generated, it will not
be added automatically in JSON file, you need to use “-s” at end of
install command
• Example
$ bower install jquery -s /*Install Jquery and update bower.json*/
More…
Bower is great tool for web developers, go and get it. Don’t left behind
in race.
• Twitter Handlers
• Bower - @Bower
• Me - @JitendraZaa
• My Blog
• http://JitendraZaa.com/blog