sassconf: managing complex projects with design components

25
John Albin Wilkins @JohnAlbin Managing Complex Projects with Design Components SassConf 2013

Upload: john-albin-wilkins

Post on 27-Jan-2015

110 views

Category:

Technology


1 download

DESCRIPTION

Our CSS sucks. We've been building sites for over a decade using crappy, ornamentation techniques and shoddy selectors. Our styles unintentional bleed across the site. Our stylesheets are fragile and unmaintainable and full of specificity landminds. Pandas wander alone in the wilderness. But there's no need to drown ourselves in beer. New techniques like OOCSS, SMACSS and BEM show us that planning before building can make our projects maintainable, easier to debug, and smaller with reduced CSS file sizes. This workshop will introduce the basic techniques for CSS layering and using design components, the heart of any front-end CSS project. We will also discuss Sass organization and tips to more easily implement these ideas.

TRANSCRIPT

Page 1: SassConf: Managing Complex Projects with Design Components

John Albin Wilkins@JohnAlbin

Managing Complex Projects with Design

Components

SassConf 2013

Page 2: SassConf: Managing Complex Projects with Design Components

John Albin Wilkins@JohnAlbin

SassConf 2013

Page 3: SassConf: Managing Complex Projects with Design Components

★ Zen Gridshttp://zengrids.com

★ Normalize.css for Sass/Compasshttp://bit.ly/normalize-with-compass

★ Succinct theme for Colloquy (IRC for Mac)https://github.com/JohnAlbin/succinct-for-colloquy

★ git-svn-migratehttp://john.albin.net/git/git-svn-migrate

★ Zen theme for Drupalhttps://drupal.org/project/zen

Free Gifts From Me

Page 4: SassConf: Managing Complex Projects with Design Components

Due in Winter 2013

May contain Lemurs.

Introduction toSass and CompassO’Reilly

Page 5: SassConf: Managing Complex Projects with Design Components

Building Sites Outside-In

Page 6: SassConf: Managing Complex Projects with Design Components

CSSSpecificity Wars

Page 7: SassConf: Managing Complex Projects with Design Components

.menu .item a:link {}

.sidebar .menu .item a:link {}

.page-37 .sidebar .menu

.item a:link {}

CSSSpecificity Wars

Page 8: SassConf: Managing Complex Projects with Design Components

.menu .item a:link {

.sidebar & {

.page-37 & {}

}

}

CSSSpecificity Wars

Page 9: SassConf: Managing Complex Projects with Design Components

Seemed like a good ideaat the time.

Page 10: SassConf: Managing Complex Projects with Design Components

“Are you new to front-end web development?

 Here’s a secret: no one else really knows what they’re doing either.”

— @necolas

         Nicolas Gallagher

Page 11: SassConf: Managing Complex Projects with Design Components

What are Design Components?

★ “Component” is the same as…

★ “Object” in OOCSS

★ “Module” in SMACSS

★ “Block” in BEM’s Block-Element-Modifier

★ “UI Pattern”

Page 12: SassConf: Managing Complex Projects with Design Components

Goals of Design Components

★ Reduce specificity

★ Reduce applicability / control the cascade

Page 13: SassConf: Managing Complex Projects with Design Components

File organization =first 3 SMACSS Layers

Page 14: SassConf: Managing Complex Projects with Design Components

Simple Folder Structure

Page 15: SassConf: Managing Complex Projects with Design Components

styles.scss

Page 16: SassConf: Managing Complex Projects with Design Components

Putting all componentsin one folder means it is ridiculously easy to find components.

★ Inspect the DOM.

★ Find the class on the design component.

★ Look for a file with that name in the components folder.

Page 17: SassConf: Managing Complex Projects with Design Components

A simple component

and a variant

(all in one file)

Page 18: SassConf: Managing Complex Projects with Design Components

.feature

A component with sub-parts

Page 19: SassConf: Managing Complex Projects with Design Components

A component with sub-parts

Page 20: SassConf: Managing Complex Projects with Design Components

A SMACSS “state”

Page 21: SassConf: Managing Complex Projects with Design Components

The “fugly” selector hack

Selector in DOMI couldn’t change

Class name I wishI could use in DOM

Page 22: SassConf: Managing Complex Projects with Design Components

On the meaning of semantics

Page 23: SassConf: Managing Complex Projects with Design Components

.omnomnomnom

is more semantic then

.blaaagh

On the meaning of semantics

Page 24: SassConf: Managing Complex Projects with Design Components

On the meaning of semantics

★ Content semanticsis handled by HTML5 elements

★ Design semanticsis handled by class names

Page 25: SassConf: Managing Complex Projects with Design Components

Thank you!

Follow me on the Twitterz.@JohnAlbin