Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bower

 Bower

Intro to Bower package manager, covers integrating with Ruby on Rails / asset pipeline.

eddie cianci

March 05, 2013
Tweet

More Decks by eddie cianci

Other Decks in Programming

Transcript

  1. INSTALLATION 1. GET NODE 2. GET BOWER b r e

    w i n s t a l l n o d e n p m i n s t a l l - g b o w e r
  2. USAGE GET JQUERY WHAT HAPPENED? 1. Query Twitter's Bower 2.

    Find jQuery 3. Clone jQuery git repo 4. Check out the latest version (git tag) 5. Check component.json & resolve any dependencies 6. Copy files to local dir b o w e r i n s t a l l j q u e r y . . . b o w e r c l o n i n g g i t : / / g i t h u b . c o m / c o m p o n e n t s / j q u e r y . g i t . . . b o w e r c a c h e d g i t : / / g i t h u b . c o m / c o m p o n e n t s / j q u e r y . g i t . . . b o w e r f e t c h i n g j q u e r y . . . b o w e r c h e c k i n g o u t j q u e r y # 1 . 9 . 1 . . . b o w e r c o p y i n g ~ / . b o w e r / c a c h e / j q u e r y / c f 6 8 c 4 c 4 e 7 5 0 7 c 8 d 2 0 f e e 7 b 5 x x x . . . b o w e r i n s t a l l i n g j q u e r y # 1 . 9 . 1 registry
  3. ASSETS AS GEMS? Kinda sucks. ಠ_ಠ Versioning latency External maintainers

    Boilerplate code So many options http://rubygems.org/search?query=bootstrap
  4. BOWER INNIT Create .bowerrc file in project root Create vendor/assets/components/component.json

    Add asset pipeline load path in config/application.rb Run the damn thing { " d i r e c t o r y " : " v e n d o r / a s s e t s / c o m p o n e n t s " , " j s o n " : " v e n d o r / a s s e t s / c o m p o n e n t s / c o m p o n e n t . j s o n " } { " d e p e n d e n c i e s " : { " b o o t s t r a p " : " ~ 2 . 3 . 0 " } } c o n f i g . a s s e t s . p a t h s < < R a i l s . r o o t . j o i n ( ' v e n d o r / a s s e t s / c o m p o n e n t s ' ) b o w e r i n s t a l l
  5. CAVEAT DEVELOPER Endpoint must be a git repo Asset versions

    must follow Current best practice is to .gitignore components/* What about deployment? ¯\_( â)_/¯ Options Run bower locally, scp results Run bower remotely Heroku, custom buildpack??? semver
  6. COOL SHIT I DIDNT COVER ( y°□°Á y Œ━ Œ

    Bash autocompletion b o w e r i n s t a l l < p k g > r e g i s t e r your own bower packages use ­ ­ s a v e to add component.json dependencies