78
OOCSS IN THE REAL WORLD A Case Study from the CBC Jamie Strachan @jamiestrachan

OOCSS in the Real World: A Case Study from the CBC - Revisited

Embed Size (px)

DESCRIPTION

CBC.ca is one of the biggest and most popular sites in Canada and our team was tasked with overhauling the front-end to improve our site speed and development process. I'll share the process we went through and highlight the benefits and challenges of moving to OOCSS so you'll be better prepared to do the same. From this session, you'll learn: - the key advantages of OOCSS as well as its drawbacks - how to rebuild an existing site using OOCSS - how a CSS preprocessor can work with OOCSS - what has happened in the 12 months since we launched Originally presented at CSS Dev Conf 2014.

Citation preview

Page 1: OOCSS in the Real World: A Case Study from the CBC - Revisited

OOCSS IN THE

REAL WORLD A Case Study from the CBC

Jamie Strachan

@jamiestrachan

Page 2: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 3: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 4: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 5: OOCSS in the Real World: A Case Study from the CBC - Revisited

CBC.CA

3 million pages in Google

4.5 million visits per month

200 stories a day

20 UI developers +

Complexity

Page 6: OOCSS in the Real World: A Case Study from the CBC - Revisited

http://www.flickr.com/photos/samsushiro/8741594581

Page 7: OOCSS in the Real World: A Case Study from the CBC - Revisited

How can we do things better?

OOCSS

Page 8: OOCSS in the Real World: A Case Study from the CBC - Revisited

OOCSS is a technique,

not a technology

Page 9: OOCSS in the Real World: A Case Study from the CBC - Revisited

NICOLE SULLIVAN

stubbornella.org

Page 10: OOCSS in the Real World: A Case Study from the CBC - Revisited

“Following our beloved best

practices leads to bad outcomes

every. single. time.” ~Nicole Sullivan

Page 11: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 12: OOCSS in the Real World: A Case Study from the CBC - Revisited

.topstories ul.primary { float: left; width: 75%; }

.topstories ul.secondary { float: right; width: 25%; }

.topstories ul.secondary li { border-bottom: 1px solid #ccc; }

Page 13: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 14: OOCSS in the Real World: A Case Study from the CBC - Revisited

#editorspicks {

background: #eee; border-top: 5px solid #ccc; }

#editorspicks ul li { border-bottom: 1px solid #ccc; }

Page 15: OOCSS in the Real World: A Case Study from the CBC - Revisited

STATS

Style sheets

float: left;

font-size: *;

width: 300px;

border-top: 5px solid #c4c4c4;

Page 16: OOCSS in the Real World: A Case Study from the CBC - Revisited

STATS

Style sheets 16

float: left; 78

font-size: *; 114

width: 300px; 34

border-top: 5px solid #c4c4c4; 7

Page 17: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 18: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 19: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 20: OOCSS in the Real World: A Case Study from the CBC - Revisited

.media

Page 21: OOCSS in the Real World: A Case Study from the CBC - Revisited

.media_reversed

Page 22: OOCSS in the Real World: A Case Study from the CBC - Revisited

EMBRACE

VISUAL SEMANTICS

Page 23: OOCSS in the Real World: A Case Study from the CBC - Revisited

OPERATION

TWITTER BOOTSTRAP

Page 24: OOCSS in the Real World: A Case Study from the CBC - Revisited

THE PLAN

1. Find a framework

2. Use it

Page 25: OOCSS in the Real World: A Case Study from the CBC - Revisited

FRAMEWORKS

• Twitter Bootstrap

•OOCSS

• inuit.css

•Pure

Page 26: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 27: OOCSS in the Real World: A Case Study from the CBC - Revisited

OPERATION

CBC BOOTSTRAP

Page 28: OOCSS in the Real World: A Case Study from the CBC - Revisited

THE PLAN

1. Identify visual patterns

2. Codify objects

3. Get crazy with the classes

Page 29: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

RETRAINING YOUR GUT

Page 30: OOCSS in the Real World: A Case Study from the CBC - Revisited

BENEFIT

GRIDS ARE A GATEWAY

TO OOCSS

Page 31: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

NAMING IS HARD

Page 32: OOCSS in the Real World: A Case Study from the CBC - Revisited

.distinct

Page 33: OOCSS in the Real World: A Case Study from the CBC - Revisited

BENEFIT

TIGHTER INTEGRATION

WITH DESIGN

Page 34: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 35: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

FINDING THE RIGHT

GRANULARITY

Page 36: OOCSS in the Real World: A Case Study from the CBC - Revisited

BENEFIT

SEEING THE

REUSE HAPPEN

Page 37: OOCSS in the Real World: A Case Study from the CBC - Revisited

.contentlist

Page 38: OOCSS in the Real World: A Case Study from the CBC - Revisited

.contentlist_grid

Page 39: OOCSS in the Real World: A Case Study from the CBC - Revisited

.repel

Page 40: OOCSS in the Real World: A Case Study from the CBC - Revisited

.videolink

Page 41: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 42: OOCSS in the Real World: A Case Study from the CBC - Revisited

BENEFIT

A CMS PRODUCES

STANDARDIZED CODE

Page 43: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

A CMS PRODUCES

STANDARDIZED CODE

Page 44: OOCSS in the Real World: A Case Study from the CBC - Revisited

LINEUP ROLL

News Sports

Page 45: OOCSS in the Real World: A Case Study from the CBC - Revisited

The greatest weakness of OOCSS is the

tight coupling between HTML and design

Page 46: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 47: OOCSS in the Real World: A Case Study from the CBC - Revisited

LINEUP ROLL

News Sports

Page 48: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 49: OOCSS in the Real World: A Case Study from the CBC - Revisited

OPERATION

WIDOWMAKER

Page 50: OOCSS in the Real World: A Case Study from the CBC - Revisited

THE QUESTION

How do we have

• reusable objects,

• fixed HTML, and

•multiple themes?

Page 51: OOCSS in the Real World: A Case Study from the CBC - Revisited

THE ANSWER

Page 52: OOCSS in the Real World: A Case Study from the CBC - Revisited

SASS @extend

Pre-compile Post-compile

Page 53: OOCSS in the Real World: A Case Study from the CBC - Revisited

LINEUP ROLL

News Sports

Page 54: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 55: OOCSS in the Real World: A Case Study from the CBC - Revisited

news.scss sports.scss

Page 56: OOCSS in the Real World: A Case Study from the CBC - Revisited

Output SASS

@extend OOCSS

Core Library

news.scss news.css

sports.scss sports.css

Page 57: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

BUILD PROCESS IS

MORE COMPLEX

Page 58: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

COMPILED CODE

IS OBFUSCATED

Page 59: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 60: OOCSS in the Real World: A Case Study from the CBC - Revisited

BENEFIT

“BACKWARD COMPATIBLE”

Page 61: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 62: OOCSS in the Real World: A Case Study from the CBC - Revisited

BENEFIT

OPTIMIZATION

BECOMES CLEAR

Page 63: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 64: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 65: OOCSS in the Real World: A Case Study from the CBC - Revisited

PODIUM

• Reusable

• Scalable

• Flexible

• Themeable

Page 66: OOCSS in the Real World: A Case Study from the CBC - Revisited

STATS

Before

Style sheets 16

float: left; 78

font-size: *; 114

width: 300px; 34

border-top: 5px solid #c4c4c4; 7

Page 67: OOCSS in the Real World: A Case Study from the CBC - Revisited

STATS

Before After

Style sheets 16 11

float: left; 78 47

font-size: *; 114 94

width: 300px; 34 3

border-top: 5px solid #c4c4c4; 7 1

Page 68: OOCSS in the Real World: A Case Study from the CBC - Revisited

STATS

Before After Podium

Style sheets 16 11 1

float: left; 78 47 9

font-size: *; 114 94 48

width: 300px; 34 3 1

border-top: 5px solid #c4c4c4; 7 1 1

Page 69: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 70: OOCSS in the Real World: A Case Study from the CBC - Revisited

STATS

Then

Style sheets 1

float: left; 9

font-size: *; 48

width: 300px; 1

border-top: 5px solid #c4c4c4; 1

Page 71: OOCSS in the Real World: A Case Study from the CBC - Revisited

STATS

Then Now

Style sheets 1 1

float: left; 9 11

font-size: *; 48 54

width: 300px; 1 1

border-top: 5px solid #c4c4c4; 1 1

Page 72: OOCSS in the Real World: A Case Study from the CBC - Revisited

STATS

Then Now

Style sheets 1 1

float: left; 9 11

font-size: *; 48 54

width: 300px; 1 1

border-top: 5px solid #c4c4c4; 1 1

File size (minified) 38k 54k

Page 73: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

EDUCATION IS

ESSENTIAL

Page 74: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

“BACKWARD COMPATIBILITY” IS A

DOUBLE-EDGED SWORD

Page 75: OOCSS in the Real World: A Case Study from the CBC - Revisited
Page 76: OOCSS in the Real World: A Case Study from the CBC - Revisited

CHALLENGE

USE SASS

PROPERLY

Page 77: OOCSS in the Real World: A Case Study from the CBC - Revisited

THE BIG TAKEAWAY

OOCSS IS THE

NEW BEST PRACTICE

Page 78: OOCSS in the Real World: A Case Study from the CBC - Revisited

RESOURCES

Jonathan Snook SMACSS

http://snook.ca

Nicole Sullivan OOCSS

http://stubbornella.org

Harry Roberts inuit.css

http://csswizardry.com

Yandex BEM

http://bem.info

Jamie Strachan @jamiestrachan