Anzeige
Anzeige

Más contenido relacionado

Anzeige
Anzeige

Introduction to bower

  1. Introduction to Bower www.JitendraZaa.com
  2. What is this • Client side package Manager • Great tool to manage all you web dependencies like JavaScript libraries
  3. 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
  4. 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
  5. 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*/
  6. Commands
  7. Bower list • It will check for latest versions of all components installed by bower in current folder
  8. Bower list --path • It will show path to be used in your webpage for all components installed by bower
  9. Bower uninstall <lib_name> • If you want to uninstall any previously downloaded library then • $ bower uninstall jquery /*It will remove JQuery*/
  10. 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
  11. Create Your own package and distribute
  12. 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
  13. 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*/
  14. 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
Anzeige