introduction to bower
DESCRIPTION
What is Bower and why all web developers should consider to use it ?TRANSCRIPT
Introduction to Bowerwww.JitendraZaa.com
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*/
Commands
Bower list
• It will check for latest versions of all components installed by bower in current folder
Bower list --path
• It will show path to be used in your webpage for all components installed by bower
Bower uninstall <lib_name>
• If you want to uninstall any previously downloaded library then
• $ bower uninstall jquery /*It will remove JQuery*/
Install specific version of library
• If you want to use older version of library, say 1.11.0 of Jquery
• $ bower install jquery#1.11.0
Create Your own package and distribute
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