Slide 1

Slide 1 text

Bower

Slide 2

Slide 2 text

We make websites

Slide 3

Slide 3 text

Lots of stuff Bootstrap Foundation normalize.css fitvid.js Modernizr d3 jQuery Underscore / Lo-dash Backbone Angular JS Effeckt.css Masonry Font Awesome Compass H5BP jQuery UI Easing form gallery modal / popup tooltip base CSS helper JS

Slide 4

Slide 4 text

How do you get it? Download git  clone Saved locally, copy files

Slide 5

Slide 5 text

Where do you put it? lib/ lib/vendor/ assets/js/vendor,   assets/css/vendor,   assets/*/vendor

Slide 6

Slide 6 text

How you keep track of it? Centralized server In git, commit to repo git-submodules

Slide 7

Slide 7 text

Lots of stuff Bootstrap Foundation normalize.css fitvid.js Modernizr d3 jQuery Underscore / Lo-dash Backbone Angular JS Effeckt.css Masonry Font Awesome Compass H5BP jQuery UI Easing form gallery modal / popup tooltip base CSS helper JS

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Messy Desk Not enough space to do work Slow down creative process Hard to collaborate Spend time cleaning desk

Slide 10

Slide 10 text

Package Management

Slide 11

Slide 11 text

Lots of stuff Bootstrap Foundation normalize.css fitvid.js Modernizr d3 jQuery Underscore / Lo-dash Backbone Angular JS Effeckt.css Masonry Font Awesome Compass H5BP jQuery UI Easing form gallery modal / popup tooltip base CSS helper JS

Slide 12

Slide 12 text

Package Management

Slide 13

Slide 13 text

Problem Package management Solution Bower Reason Why use Bower Results How I’ve done so far

Slide 14

Slide 14 text

What is Bower?

Slide 15

Slide 15 text

Bower A package manager for the web

Slide 16

Slide 16 text

What is Bower? Command-line utility Built on Node JS

Slide 17

Slide 17 text

Install packages bower  install  jquery

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Install a version bower  install  jquery#1.x

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Search packages bower  search  normalize

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

bower.json Manifest file Use same installation on another machine Collaboration

Slide 24

Slide 24 text

bower.json bower  init

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

bower.json "dependencies":  {      "jquery":  "1.x",      "normalize-­‐css":  "~2.1.3"   }

Slide 27

Slide 27 text

bower  install  bootstrap

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Installing dependencies Bower will install the package and its dependencies !"#  bootstrap#3.0.0      !""  jquery#2.0.3

Slide 30

Slide 30 text

Dependencies Powerful feature Build packages on top of one another No longer have to depend on big frameworks

Slide 31

Slide 31 text

Lots of other great features --offline: Offline mode Read the docs: bower.io

Slide 32

Slide 32 text

What Bower does Easily gets packages Keeps them organized Manages dependencies

Slide 33

Slide 33 text

Problem Solution Reason Results Package management Bower Why use Bower How I’ve done so far

Slide 34

Slide 34 text

Why Bower?

Slide 35

Slide 35 text

Package managers Volo git-submodules Jam Component Browserify (npm) Ender

Slide 36

Slide 36 text

Bower is special Unopinionated Provides no direct way to consume packages Core part of its philosophy

Slide 37

Slide 37 text

Consuming packages , SASS or preprocessor RequireJS Grunt Your own build script

Slide 38

Slide 38 text

bower  list  -­‐-­‐paths {      "bootstrap":  [          "bower_components/bootstrap/dist/js/            bootstrap.js",          "bower_components/bootstrap/dist/css/            bootstrap.css"      ],      "jquery":  "bower_components/jquery/jquery.js",      "normalize-­‐css":  "bower_components/normalize-­‐        css/normalize.css"   }

Slide 39

Slide 39 text

Unopinionated Choosing on behalf of anyone else Don’t lock your users into a methodology

Slide 40

Slide 40 text

Using Bower Twitter: Flight Google: Yeoman, Angular jQuery

Slide 41

Slide 41 text

Problem Solution Reason Results Package management Bower Unopinionated How I’ve done so far

Slide 42

Slide 42 text

Results

Slide 43

Slide 43 text

Isotope Masonry

Slide 44

Slide 44 text

Same problem with unloaded images

Slide 45

Slide 45 text

Masonry ! Isotope !

Slide 46

Slide 46 text

Masonry ! Isotope ! images
 Loaded images
 Loaded images
 Loaded

Slide 47

Slide 47 text

Masonry ! Isotope ! images
 Loaded images
 Loaded images
 Loaded

Slide 48

Slide 48 text

Maintaining one project in three places

Slide 49

Slide 49 text

Now with Bower No more committing other projects into yours Keep them separated Bower allows easily add them as dependencies

Slide 50

Slide 50 text

Front-end development with dependencies

Slide 51

Slide 51 text

Developing with dependencies Removing duplicated code jquery-bridget get-size get-style-property doc-ready eventie EventEmitter

Slide 52

Slide 52 text

Each dependency Its own repository Its own issue tracker Its own tests Finer granularity over bigger projects

Slide 53

Slide 53 text

For example: masonry#417

Slide 54

Slide 54 text

masonry#417 Issue reported in Masonry Actual problem with getSize

Slide 55

Slide 55 text

getSize Fix cut new release (v1.1.5) Masonry bower update deploy

Slide 56

Slide 56 text

Masonry ! getSize Isotope ! Dragga- billy ...

Slide 57

Slide 57 text

Encapsulation Literal naïve definition: Make capsules Breaking down something large into smaller pieces, easier to swallow

Slide 58

Slide 58 text

Encapsulation Like DRY, a principle of good programming Take and apply it project-level

Slide 59

Slide 59 text

Encapsulation A new avenue of thinking No longer had to keep mental model of entire library in my head Focus on small libraries with single purpose

Slide 60

Slide 60 text

Growing up Growing out of relying on monolithic frameworks Empowering developers to make and distribute their own purpose- built components

Slide 61

Slide 61 text

packery-­‐docs#1.0.0   $""  classie#1.0.0   $"#  doc-­‐ready#1.0.2   %  !""  eventie#1.0.3   $"#  draggabilly#1.0.6   %  $""  classie#1.0.0   %  $""  eventEmitter#4.2.4   %  $""  eventie#1.0.3   %  $"#  get-­‐size#1.1.4   %  %  !""  get-­‐style-­‐property#1.0.2   %  !""  get-­‐style-­‐property#1.0.2   $""  eventie#1.0.3   $""  get-­‐style-­‐property#1.0.2   $""  jquery#1.10.2   $""  jquery-­‐ui-­‐draggable#1.10.3   $""  normalize-­‐css#2.1.3   !"#  packery#1.1.2  

Slide 62

Slide 62 text

Problem Solution Reason Results Package management Bower Unopinionated Grow

Slide 63

Slide 63 text

How? How do you hook up Grunt tasks to Bower? How do you split a project into multiple files? How do you make JS work with both RequireJS and ? How do you create concatenated source files, for easy ing?

Slide 64

Slide 64 text

Why use Bower and not ______? Because Bower is unopinionated.

Slide 65

Slide 65 text

Why use Bower at all? Because building with dependencies is how we will grow.

Slide 66

Slide 66 text

Thank you! I have stickers. Get in my van. – @desandro