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

Refresh Tallahassee: The RE/MAX Front End Story

Refresh Tallahassee: The RE/MAX Front End Story

Come join us downstairs at the Proof Brewing Company for another excellent evening of inspiration! Rachael Moore, the front-end lead on the new remax.com, has kindly agreed to share the story of this massive (and really nicely done) site. Among the likely topics of discussion are: Object-oriented CSS, CSS preprocessors, JavaScript frameworks, and the ins and outs of working with a distributed team.

Rachael L Moore

February 12, 2013
Tweet

More Decks by Rachael L Moore

Other Decks in Programming

Transcript

  1. function moore (you) { var me = { name: Rachael

    L Moore, tel: (646) 504-0616, tweet: @morewry }; return { success: you + me }; }
  2. Performance ◦ High availability ◦ Efficient use of resources ◦

    Fast response ◦ Quick transfer & load times
  3. Maintainability ◦ Easy to add new content ◦ Easy to

    move content ◦ Easy to remove content ◦ Easy to identify problem code
  4. Thick Client ◦ Runs on client side ◦ Natural fit

    for web ◦ Lower server requirements ◦ Lowers cost ◦ Increases availability
  5. Require.js ◦ Asynchronous file loader ◦ Based on CommonJS AMD

    proposal ◦ Important for performance ◦ Helps with maintainability
  6. Require.js Modules ◦ ID (optional) ◦ Dependencies array (optional) ◦

    Callback function define( id, [dependencies], function(){ // callback } );
  7. Backbone.js ◦ Lightweight ◦ Works with JSON ◦ Keeps back

    end data in sync with front end ◦ Provides structure for models & views
  8. Backbone.js Models ◦ attributes ◦ initialize ◦ custom methods var

    Listing = Backbone.Model.extend({ initialize: function() {} , custom: function() {} });
  9. Backbone.js Views ◦ el (DOM context) ◦ events ◦ initialize

    ◦ render ◦ custom methods var ListingDetail = Backbone.View.extend({ events: { "click .btn": "qmToggle", }, initialize: function () {} , render: function () {} , qmToggle: function () {} });
  10. https://www.youtube.com/watch?v=EFiilk2LQLM Click to play video -- Example of Hogan (client

    side) and Nustache (server side) rending HTML using the same Mustache templates
  11. Mustache Tags ◦ Variables ◦ Sections ▪ If (basically) ▪

    Loop {{#pages}} <a href="{{url}}"> {{num}} </a> {{/pages}}
  12. Sass ◦ Valid CSS is valid Sass ◦ Outputs plain

    CSS ◦ Provides valuable features to developers
  13. Sass Import CSS @import "buttons.css" Sass @import "buttons" Unlike CSS

    imports, Sass imports don't necessarily generate another HTTP request.
  14. Sass Mixins CSS .error { color: #d40015; background-image: -webkit-linear- gradient(#fdf2f3,

    #f4bfc4); background-image: -moz-linear- gradient(#fdf2f3, #f4bfc4); background-image: -o-linear- gradient(#fdf2f3, #f4bfc4); background-image: linear-gradient (#fdf2f3, #f4bfc4); background-color: #fdf2f3; } Sass .error { color: $error-color; @include background( linear-gradient( lighten($error-color, 95% ), lighten($error-color, 75% ) ) ); }
  15. Sass Placeholders CSS .error { color: #d40015; } Sass %error

    { color: $error-color; } Placeholders are like classes, except they don't get output until they are used.
  16. Sass Extend CSS .error, .button-delete { color: #d40015; background-image: -webkit-linear-gradient

    (#fdf2f3, #f4bfc4); background-image: -moz-linear-gradient (#fdf2f3, #f4bfc4); background-image: -o-linear-gradient (#fdf2f3, #f4bfc4); background-image: linear-gradient (#fdf2f3, #f4bfc4); background-color: #fdf2f3; } Sass .button-delete { @extend .error; }
  17. Content Semantics ◦ Document = HTML ◦ Internal Real estate

    agent class="agent" ◦ External A person, i.e. microformat hCard
  18. Skeletons ◦ Inline block text next to others: inline block

    layout ◦ Floating complex blocks next to others: grid layout display, float, position, width
  19. Skins ◦ Headings & Links: color, font ◦ Containers &

    Buttons: bg color & gradient, shadow, borders ◦ Icons color, background, border, text-shadow, box-shadow, border-radius, etc.
  20. Combine HTML <article class="listing"> <header class="listing-head"> <h1 class="listing-title" /> <dl

    class="listing-price /> </header> <div class="listing-body"> <img class="listing-img"> <div class="listing-caption"> ... </div> </div> </article> Sass .listing { @extend %skin-12; } .listing-head { @extend %grid-row; } .listing-title { @extend %grid-unit; @extend %text-14; @extend %width-2of3; } .listing-price { @extend %grid-unit; @extend %text-20; @extend %width-1of3; } .listing-body { @extend %grid-row; } .listing-img { @extend %grid-unit; } .listing-caption { @extend %grid-last; }