thinking outside the box model: scaling css in large real-time applications

22
THINKING OUTSIDE THE BOX MODEL SCALING CSS IN LARGE REAL-TIME APPLICATIONS Matt Fairbrass, Lab49 | @matt_d_rat

Upload: matt-fairbrass

Post on 22-Jan-2018

429 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Thinking outside the box model: Scaling CSS in large real-time applications

THINKING OUTSIDE THEBOX MODEL

SCALING CSS IN LARGE REAL-TIME APPLICATIONSMatt Fairbrass, Lab49 | @matt_d_rat

Page 2: Thinking outside the box model: Scaling CSS in large real-time applications

$: WHOIS MATT FAIRBRASSUX software engineer at Lab49Originally from London, now living here in Sydney.I AngularJS, SCSS, Node

Page 4: Thinking outside the box model: Scaling CSS in large real-time applications

DECEMBER 17, 1996

Page 5: Thinking outside the box model: Scaling CSS in large real-time applications
Page 6: Thinking outside the box model: Scaling CSS in large real-time applications
Page 7: Thinking outside the box model: Scaling CSS in large real-time applications
Page 8: Thinking outside the box model: Scaling CSS in large real-time applications

Image © Lab49. All rights reserved

Page 9: Thinking outside the box model: Scaling CSS in large real-time applications

CSS AS A LANGUAGE WASN'T DESIGNED TOBE USED IN THIS WAY

Page 10: Thinking outside the box model: Scaling CSS in large real-time applications
Page 11: Thinking outside the box model: Scaling CSS in large real-time applications

WE NEED TO RE-THINK HOWWE ARCHITECT CSS

Page 12: Thinking outside the box model: Scaling CSS in large real-time applications

Linting tools Pre-processing tools OOCSS Language

methodologies BEM SASS/SCSS UX

workflow Component DrivenDesign SUIT CSS Testing Image Diffs Dependency

management File structure Device testing

Page 13: Thinking outside the box model: Scaling CSS in large real-time applications

COMPONENT DRIVEN DESIGN

Page 14: Thinking outside the box model: Scaling CSS in large real-time applications

Component-driven design at its simplest isseperation of concerns. Components are desgned

with their own logic, with one specific purpose,and only one purpose.

To separate business logic in self-containedcomponents requires focus on the interactions

between components. In other words, you haveto think about right interfaces.

Page 15: Thinking outside the box model: Scaling CSS in large real-time applications

Image © Lab49. All rights reserved

Page 16: Thinking outside the box model: Scaling CSS in large real-time applications

Image © Lab49. All rights reserved

Page 17: Thinking outside the box model: Scaling CSS in large real-time applications

SUIT CSS.ComponentName {}.ComponentName--modifierName {}.ComponentName-descendentName {}.ComponentName.is-stateOfComponent {}

.u-utilityName {}

Page 18: Thinking outside the box model: Scaling CSS in large real-time applications

Image © Lab49. All rights reserved

Page 19: Thinking outside the box model: Scaling CSS in large real-time applications

.Button {}

.Button--secondary {}

.Button--block {}

.Button-icon {}

.Accordion {}

.Accordion-header {}

.Accordion-header.is-collapsed {}

.Accordion-panel.is-collapsed {}

.Badge {}

.Badge--round {}

.Badge--positive {}

.Badge--negative {}

.Badge--warning {}

.Input {}

.Input--withIcon {}

.Input--block {}

.ContactsPanel {}

.ContactsPanel-searchInput {}

.ContactsPanel-accordion {}

.ContactsPanel-chatButton {}

.ContactsPanel-unreadCount {}

Page 20: Thinking outside the box model: Scaling CSS in large real-time applications

BENEFITS OF SUIT CSSForces us to consider seperation of concernsProvides semantic meaning to CSSReduces coupling to the structure of the DOMParents do not mutate child stylingProvides us with a psuedo encapsulation, styles do not cascadeComponents are re-usable across the platform ecosystemComponents are testable in isolation

Page 21: Thinking outside the box model: Scaling CSS in large real-time applications

CONCLUSIONEncapsulation is essential in order for code to be able to scale

The Shadow DOM will eventually provide thisUntil then, use language design methodologies

Follow component driven design:Components should do only one thingDefine good interfaces for inter-component interaction

The sum of the parts is greater than the whole:Build from the bottom-up, not top-down as with traditionalweb-page design

Page 22: Thinking outside the box model: Scaling CSS in large real-time applications

THANK YOUhttp://mattfairbrass.com/2015/06/04/sydcss-scaling-css