introduction to bower

14
Introduction to Bower www.JitendraZaa.com

Upload: jitendra-zaa-

Post on 02-Jul-2015

803 views

Category:

Technology


1 download

DESCRIPTION

What is Bower and why all web developers should consider to use it ?

TRANSCRIPT

Page 1: Introduction to bower

Introduction to Bowerwww.JitendraZaa.com

Page 2: Introduction to bower

What is this

• Client side package Manager

• Great tool to manage all you web dependencies like JavaScript libraries

Page 3: Introduction to bower

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

Page 4: Introduction to bower

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

Page 5: Introduction to bower

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*/

Page 6: Introduction to bower

Commands

Page 7: Introduction to bower

Bower list

• It will check for latest versions of all components installed by bower in current folder

Page 8: Introduction to bower

Bower list --path

• It will show path to be used in your webpage for all components installed by bower

Page 9: Introduction to bower

Bower uninstall <lib_name>

• If you want to uninstall any previously downloaded library then

• $ bower uninstall jquery /*It will remove JQuery*/

Page 10: Introduction to bower

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

Page 11: Introduction to bower

Create Your own package and distribute

Page 12: Introduction to bower

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

Page 13: Introduction to bower

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*/

Page 14: Introduction to bower

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