Professional Documents
Culture Documents
OOCSS - Keep It Small: Joomla!dagen Nederland 2014
OOCSS - Keep It Small: Joomla!dagen Nederland 2014
OOCSS - Keep It Small: Joomla!dagen Nederland 2014
Babs Gösgens
e @babsgosgens
www.crossinghippos.com
er @crossinghippos
Modular CSS
Joomla!dagen Nederland 2014
“CSS has become more interesting and more
complicated.”
h!p://www.sitepoint.com/architecture-sass-project/
WET
Be!er ?
Context
Be!er ?
Re-usability
Be!er ?
(Cross media) Semantics
Be!er ?
Persistent Grid
Be!er ?
Facebook
Source: thekmiecs.com
Media Object
• 5 Lines of CSS
• HTML
• CSS
• JavaScript
• …
OOCSS Systemen
• OOCSS
• SMACCS
• BEM
• Atomic CSS
• …
BEM
Block-Element-Modifier
Block
• Independent Entity
Bron: h!p://bem.info/method/definitions/
Element
• Context-dependent
Bron: h!p://bem.info/method/definitions/
Modifier
• Multiple modifiers
Bron: h!p://bem.info/method/definitions/
BEM Classes
.block { }
.block__element { }
.block--modifier { }
Person
Media Object in BEM
Not everything is BEM
“Good names don’t change.”
–W3C
h!p://www.w3.org/QA/Tips/goodclassnames
Class names
h!p://www.w3.org/QA/Tips/goodclassnames
Classisitis
Source: h!p://www.staceyreid.com
Good habits
• Use shallow selectors
• Avoid context
• !important
Specificity
• Universal selectors
bad!
• Tag (type) selectors
• ID selectors
• Inline styles
Methods
• Structure
• Ordering
• Context
• Comments
• Functions
• Inheritance
• Maps
“One file to rule them all,
One file to find them,
One file to bring them all,
And in the Sass way merge them.”
– J.R.R. Tolkien (& Hugo Giraudel)
Partials
Source: h!p://www.sitepoint.com/architecture-sass-project/
SASS & BEM
SASS & BEM
Abstraction exercise
Abstraction exercise
Sources
• h!p://bem.info/ • h!p://smacss.com/
• h!p://bradfrostweb.com/blog/post/atomic-web-design/ • h!p://snook.ca/
• h!p://clubmate.fi/oocss-acss-bem-smacss-what-are-they- • h!p://www.alwaystwisted.com/post.php?s=2014-02-27-
what-should-i-use/ even-easier-bem-ing-with-sass-33
• h!p://coding.smashingmagazine.com/2011/12/12/an- • h!p://www.bre!jankord.com/2013/02/09/thoughts-on-
introduction-to-object-oriented-css-oocss/ semantic-html-class-names-and-maintainability/
• h!p://csswizardry.com/2011/09/writing-efficient-css- • h!p://www.mathayward.com/modular-css-with-sass-
selectors/ and-bem/
• h!p://csswizardry.com/2013/01/mindbemding-ge!ing- • h!p://www.sitepoint.com/architecture-sass-project/
your-head-round-bem-syntax/ • h!p://www.sitepoint.com/css-sass-styleguide/
• h!p://hugogiraudel.com/ • h!p://www.slideshare.net/maxdesign/css-oocss-and-
• h!p://nicoespeon.com/en/2013/05/dive-into-oocss/ smacss
• h!p://nicolasgallagher.com/about-html-semantics-front- • h!ps://github.com/necolas/idiomatic-css
end-architecture/ • h!ps://github.com/stubbornella/oocss/wiki
• h!p://rhodesmill.org/brandon/2011/concentric-css/
• h!p://sass-lang.com/
a
www.facebook.com/crossinghippos
h!p://www.slideshare.net/babsgosgens