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

Forefront Leeds - Andy Fitch - 18/11/2013

Avatar for andyfitch andyfitch
November 18, 2013

Forefront Leeds - Andy Fitch - 18/11/2013

A Mobile-first, OOCSS approach to Responsive Web Design

Avatar for andyfitch

andyfitch

November 18, 2013
Tweet

Other Decks in Programming

Transcript

  1. • Summary of our development process ! ! • OOCSS

    + Responsive Web Design ! ! • Tools, tips & tricks for RWD & Retina
  2. • 3 front-end developers ! • 3 back-end developers Andrew

    Hathaway @andrewhathaway Daniel Le Page @dannylepage Jack Roscoe @northernintro James Hall @MrRio Aran Wilkinson @aran384 Nathaniel Higgins @nathggns
  3. • Reduce code block ! ! • Medium - large

    projects ! ! • Half front-end, half back-end
  4. HTML CSS Grunt Bower Compass CakePHP Inuit CSS JSON BEM

    RWD MVC DRY SRP JavaScript SASS PHP jQuery Knockout RequireJS
  5. Development Process at Parallax • Scoping / feasibility ! •

    Wireframing ! • Design ! • Development
  6. Wireframing • An iterative process with designers, right through to

    development • Don’t be afraid of pen & paper!
  7. Development • Bower - package manager ! Search, install, update

    & remove packages • Grunt - task manager ! Ditch CodeKit! • RequireJS - file and module loader ! Dependencies
  8. Responsive Web Design Developers have a terrible habit of making

    assumptions for their own convenience… ! …base your decisions on facts and evidence! All web design should be responsive Elastic?
  9. Assumptions are toxic! DO NOT ASSUME mobile users only want

    your primary content! ! Mobile users want the same information desktop users do, they just have different priorities
  10. Assumptions are toxic! DO NOT ASSUME mobile users only want

    your primary content! ! Mobile users want the same information desktop users do, they just have different priorities
  11. DO NOT ASSUME anyone who is not using a desktop

    is using an iPhone or an iPad. ! RWD stands for Responsive Web Design RWD does not stand for Reliable With Devices-made-by-Apple
  12. • Abstracted code is lovely, generic, reusable code ! •

    Objects ! • Rapid development ! • Helpers <div class=“media”> <div class=“media”> <div class=“media”> <div class=“media”> <div class=“media”> <div class=“media”> <div class=“media”> <div class=“media”> <div class=“media”> <div class=“media”>
  13. @media all and (min-width: 1000px) { @media all and (min-width:

    768px) { @media all and (min-width: 600px) { @media all and (min-width: 420px) {
  14. @media all and (min-width: 1000px) { @media all and (min-width:

    768px) { @media all and (min-width: 600px) { @media all and (min-width: 420px) { Break points! not Device points
  15. Single Responsibility Principle (SRP)! (each class has one job &

    one job only) ! ! is completely at odds with ! ! Responsive Web Design! (many jobs at different states)
  16. <div class=“grid”> <div class=“grid__item one-whole soft-half—top soft-half--bottom”> </div> <div class=“grid__item

    one-whole soft--top”> </div> <div class=“grid__item one-whole soft-half—bottom”> </div> </div>
  17. .one-whole { width: 100%; } ! @media all and (min-width:

    700px) { .one-whole { ! } } ! @media all and (min-width: 1000px) { .one-whole { } } <div class=“grid”> <div class=“grid__item one-whole soft-half—top soft-half--bottom”> </div> <div class=“grid__item one-whole soft--top”> </div> <div class=“grid__item one-whole soft-half—bottom”> </div> </div>
  18. <div class=“grid grid--one-two-three”> <div class=“grid__item grid__item--primary soft-half--top soft-half--bottom”> </div> <div

    class=“grid__item grid__item--secondary soft--top”> </div> <div class=“grid__item grid__item—tertiary soft-half--bottom”> </div> </div>
  19. <div class=“grid grid--one-two-three”> <div class=“grid__item grid__item--primary soft-half--bottom”> </div> <div class=“grid__item

    grid__item--secondary”> </div> <div class=“grid__item grid__item—tertiary”> </div> </div> .grid—one-two-three { .grid__item--primary { width: 100%; } .grid__item--secondary { width: 100%; } .grid__item--tertiary { width: 100%; } } @media all and (min-width: 700px) { .grid—one-two-three { .grid__item—primary { width: 66.6666%; } .grid__item—secondary { width: 33.3333%; } .grid__item--tertiary { width: 100%; } } } @media all and (min-width: 1000px) { .grid—one-two-three { .grid__item--primary { width: 50%; } .grid__item--secondary { width: 25%; } .grid__item--tertiary { width: 25%; } } }
  20. .grid—one-two-three { .grid__item--primary { width: 100%; } .grid__item--secondary { width:

    100%; } .grid__item--tertiary { width: 100%; } } @media all and (min-width: 700px) { .grid—one-two-three { .grid__item—primary { width: 66.6666%; } .grid__item—secondary { width: 33.3333%; } .grid__item--tertiary { width: 100%; } } } @media all and (min-width: 1000px) { .grid—one-two-three { .grid__item--primary { width: 50%; } .grid__item--secondary { width: 25%; } .grid__item--tertiary { width: 25%; } } } Mobile Tablet Desktop
  21. • Define layouts in a top-level class • Comment your

    code!! /yccc-skin/objects/_grids.scss /yccc-skin/responsive/_grids.scss
  22. • Packery http://packery.metafizzy.co/ ! • Hammer.js http://eightmedia.github.io/hammer.js/ ! • cssarrowplease

    http://cssarrowplease.com/ ! • FF Chartwell https://www.fontfont.com/how-to-use-ff-chartwell ! ! ! ! ! ! ! ! ! • Chosen http://harvesthq.github.io/chosen/ General
  23. • * { box-sizing: border-box; } (IE8+) • http://www.paulirish.com/2012/box-sizing-border-box-ftw/ !

    ! • JSConsole - iOS Simulator & Android Debug Bridge • http://jsconsole.com/ ! ! • Flowtype • http://simplefocus.com/flowtype/ Responsive
  24. • ImageOptim-CLI • https://github.com/JamieMason/ImageOptim-CLI ! • Compressive images • http://filamentgroup.com/lab/rwd_img_compression/

    ! • Retina Cookie trick • https://github.com/andyfitch/retina-cookie-trick ! • ReSRC.it • http://www.resrc.it/ ! • Current state of responsive images, srcset, src-N etc.: • http://html5doctor.com/responsive-images-end-of-year-report/ Retina