MANAGING COMPLEX PROJECTS 
WITH DESIGN COMPONENTS 
J O H N A L B I N W I L K I N S 
F R O N T - E N D T R A C K — O C T O B E R 1 , 2 0 1 4
@JOHNALBIN 
Senior Front-end Developer
FREE GIFTS FROM ME 
Zen Grids 
zengrids.com 
! 
Normalize.css for Sass/Compass 
github.com/JohnAlbin/normalize-scss 
Succinct theme for Colloquy (IRC for Mac) 
github.com/JohnAlbin/succinct-for-colloquy 
git-svn-migrate 
john.albin.net/git/git-svn-migrate 
Zen theme for Drupal 
drupal.org/project/zen
TRIGGER ALERT 
This session will mention the word: 
AGILE
WHERE ARE WE HEADED?
“ARE YOU NEW TO 
FRONT-END WEB DEVELOPMENT? 
HERE’S A SECRET: 
NO ONE ELSE REALLY KNOWS 
WHAT THEY’RE DOING EITHER.” 
– N I C O L A S G A L L AG H E R 
January, 2013
WHAT THE HELL IS GOING ON? 
Process Technology
IS THERE A BIGGER PICTURE? 
Vagrant Twig / Handlerbars 
Grunt/Gulp 
task runner 
Jenkins / CI 
build tools 
npm shrinkwrap / Bundler 
Web Components 
CSS frameworks 
Bootstrap / Foundation 
CSS/JS linting 
Yeoman / Bower! 
scaffolding tools 
Behat / Selenium 
regression testing 
Sass / Less
IS THERE A BIGGER PICTURE? 
Vagrant Twig / Handlerbars 
Grunt/Gulp 
task runner 
Component 
Jenkins / CI 
build tools 
npm shrinkwrap / Bundler 
Travis 
Web Components 
CSS frameworks 
Bootstrap / Foundation 
CSS/JS linting 
Yeoman / Bower! 
scaffolding tools 
Behat / Selenium 
regression testing 
Sass / Less 
YSlow 
PageSpeed 
Cucumber 
KSS Wraith 
Web Starter Kit 
CSSLoad 
Node.js
IS THERE A BIGGER PICTURE? 
Continuous 
Integration 
Component 
Library
IS THERE A BIGGER PICTURE? 
Continuous 
Integration 
Component 
Library 
are documented by! 
style guides 
Agile Development! 
requires
WATERFALL PROJECT 
Plan 
Design 
Develop 
Theme 
Start Deadline
WATERFALL PROJECT 
Plan 
: 
Design 
: 
Develop 
: 
Theme 
Today 
: 
Start Deadline
Agile development
Reduce your risk 
by controlling/minimizing your risk
AGILE PROJECT 
Feature backlog 
Feature #1 
Feature #2 
Feature #3 
Feature #4 
Feature #5 
Feature #6 
Feature #7 
Feature #8 
Feature #9 
Feature #10 
Start 
Deadline 
Sprint Sprint Sprint Sprint Sprint Sprint Sprint
AGILE PROJECT 
Each 2-week sprint: 
• Prioritizes project goals 
• Completes a set of features 
• Creates a releasable product 
Feature backlog 
Feature #1 
Feature #2 
Feature #3 
Feature #4 
Feature #5 
Feature #6 
Feature #7 
Feature #8 
Feature #9 
Feature #10 
Start 
Deadline 
Sprint Sprint Sprint Sprint Sprint Sprint Sprint
AGILE + WEB = ? 
Component-based design 
+ 
Automated style guides
STYLEGUIDE-DRIVEN DEVELOPMENT: 
THE NEW WEB DEVELOPMENT 
J O H N A L B I N W I L K I N S 
F R O N T - E N D T R A C K — O C T O B E R 1 , 2 0 1 4
STYLE GUIDE DRIVEN DEVELOPMENT 
Only requirements are: 
Component-based design 
and 
Automated style guides
What are we doing 
wrong?
CSS SPECIFICITY 
WARS
CSS SPECIFICITY 
WARS 
.menu .item a:link {}! 
.sidebar .menu .item a:link {}! 
.page-37 .sidebar .menu .item a:link {}
CSS SPECIFICITY 
WARS 
.menu .item a:link {! 
.sidebar & {! 
.page-37 & {}! 
}! 
}
OVERLY GENERIC CLASS NAMES 
.title&{&} 
.block&.title&{&} 
.node&.title&{&} 
.views&.title&{&} 
.content&{&} 
.block&.content&{&} 
.node&.content&{&} 
.views&.content&{&}
SEEMED LIKE A GOOD IDEA 
AT THE TIME
WHAT IS A DESIGN COMPONENT? 
“Component” is the same as… 
⨯ “Object” in OOCSS 
⨯ “Module” in SMACSS 
⨯ “Block” in BEM’s Block-Element-Modifier 
⨯ “UI Pattern”
CSS DESI GN COMPONENTS ARE: 
⨯ Applied to a loose collection of HTML elements 
⨯ Repeatable 
(even if never repeated) 
⨯ Specific 
Replace CSS specificity with specific names 
⨯ Self contained 
Styles do not bleed onto anything else 
⨯ Nest-able
SMACSS 
1.BASE 
2.LAYOUT 
3.MODULE 
4.STATE 
5.THEME
SMACSS 
1.BASE 
2.LAYOUT 
3.COMPONENTS 
4.STATE 
5.SKIN 
1.BASE 
2.LAYOUT 
3.MODULE 
4.STATE 
5.THEME
SMACSS 
1.BASE 
2.LAYOUT 
3.COMPONENTS 
4.STATE 
5.SKIN
SMACSS 
1.BASE 
2.LAYOUT 
3.COMPONENTS 
3.1.STATE 
3.2.SKIN
SMACSS 
BEM 
} 
1.BASE 
2.LAYOUT 
3.COMPONENTS 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFIER 
3.4.STATE 
3.5.SKIN
“You see, radio is a kind 
of a very, very long . cat.
You pull his tail in New 
York and his head is 
meowing in Los Angeles.
Do you understand this? 
You send signals here, they 
receive them there. The 
only difference is that…
…there is no cat.” 
— Albert Einstein
.flower 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFI ER 
3.4.STATE 
3.5.SKIN
.flower_ _ petals 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFI ER 
3.4.STATE 
3.5.SKIN
.flower_ _face .flower_ _stem 
.flower_ _leaves
.flower_ _ bed 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFI ER 
3.4.STATE 
3.5.SKIN
.flower--tulip 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFI ER 
3.4.STATE 
3.5.SKIN
Don’t make it complicated 
.channel-tab_ _guide_ _upcoming-
Don’t make it complicated 
guide_ _upcoming-video_ _info_ _time
On semantic naming 
⨯ Content semantics 
are handled by HTML5 elements 
⨯ Let’s make our class names use 
Design semantics 
⨯ Class names should be meaningful to 
developers and designers
.flower:hover 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFIER 
3.4.STATE 
3.5.SKIN
.flower.is-pollinating 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFIER 
3.4.STATE 
3.5.SKIN
@media (min-width: 48em) { .flower } 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFIER 
3.4.STATE 
3.5.SKIN
@media print { .flower } 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFIER 
3.4.STATE 
3.5.SKIN
.is-night .flower 
! 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFIER 
3.4.STATE 
3.5.SKIN ( global modfier )
.flower 
An automated 
style guide of 
.flower is available: 
! 
johnalbin.github.io/flower-power
All the selectors 
.the3component& 
.the3component33modifier& 
.the3component__an3element& 
.the3component33modifier__an3element& 
.the3component.is3state& 
& .the3component:hover& 
& @media&all&{&.the3component&{}&}& 
.the3skin&.the3component
CSS DESI GN COMPONENTS ARE: 
⨯ Applied to a loose collection of HTML elements 
⨯ Repeatable 
(even if never repeated) 
⨯ Specific 
Replace CSS specificity with specific names 
⨯ Self contained 
Styles do not bleed onto anything else 
⨯ Nest-able
SMACSS 
BEM 
} 
1.BASE 
2.LAYOUT 
3.COMPONENTS 
3.1.COMPONENT 
3.2.ELEMENT 
3.3.MODIFIER 
3.4.STATE 
3.5.SKIN
Drupal 8 CSS coding standards 
www.drupal.org/node/1886770
FILE ORGANIZATION = 3 SMACSS CATEGORIES
SIMPLE SASS SETUP
STYLES.SCSS
SIMPLE FOLDER STRUCTURE
EASY TO FIND YOUR COMPONENTS. 
⨯ Inspect the DOM. 
⨯ Find the CSS class on the 
component. 
⨯ Look for a file with that 
name in the components 
folder.
THE “Fugly” SELECTOR HACK
THE “Fugly” SELECTOR HACK 
Selector in DOM 
I couldn’t change 
Class name I wish 
I could use in DOM
AUTOMATED STYLE GUIDE 
kss-node 
github.com/kss-node/kss-node
AUTOMATED STYLE GUIDE
WHAT DID YOU THINK? 
E V A U L A T E T H I S S E S S I O N - A M S T E R D A M 2 0 1 4 . D R U P A L . O R G / S C H E D U L E 
THANK YO U!

Styleguide-Driven Development: The New Web Development

  • 1.
    MANAGING COMPLEX PROJECTS WITH DESIGN COMPONENTS J O H N A L B I N W I L K I N S F R O N T - E N D T R A C K — O C T O B E R 1 , 2 0 1 4
  • 2.
  • 3.
    FREE GIFTS FROMME Zen Grids zengrids.com ! Normalize.css for Sass/Compass github.com/JohnAlbin/normalize-scss Succinct theme for Colloquy (IRC for Mac) github.com/JohnAlbin/succinct-for-colloquy git-svn-migrate john.albin.net/git/git-svn-migrate Zen theme for Drupal drupal.org/project/zen
  • 4.
    TRIGGER ALERT Thissession will mention the word: AGILE
  • 5.
    WHERE ARE WEHEADED?
  • 6.
    “ARE YOU NEWTO FRONT-END WEB DEVELOPMENT? HERE’S A SECRET: NO ONE ELSE REALLY KNOWS WHAT THEY’RE DOING EITHER.” – N I C O L A S G A L L AG H E R January, 2013
  • 7.
    WHAT THE HELLIS GOING ON? Process Technology
  • 8.
    IS THERE ABIGGER PICTURE? Vagrant Twig / Handlerbars Grunt/Gulp task runner Jenkins / CI build tools npm shrinkwrap / Bundler Web Components CSS frameworks Bootstrap / Foundation CSS/JS linting Yeoman / Bower! scaffolding tools Behat / Selenium regression testing Sass / Less
  • 9.
    IS THERE ABIGGER PICTURE? Vagrant Twig / Handlerbars Grunt/Gulp task runner Component Jenkins / CI build tools npm shrinkwrap / Bundler Travis Web Components CSS frameworks Bootstrap / Foundation CSS/JS linting Yeoman / Bower! scaffolding tools Behat / Selenium regression testing Sass / Less YSlow PageSpeed Cucumber KSS Wraith Web Starter Kit CSSLoad Node.js
  • 10.
    IS THERE ABIGGER PICTURE? Continuous Integration Component Library
  • 11.
    IS THERE ABIGGER PICTURE? Continuous Integration Component Library are documented by! style guides Agile Development! requires
  • 12.
    WATERFALL PROJECT Plan Design Develop Theme Start Deadline
  • 13.
    WATERFALL PROJECT Plan : Design : Develop : Theme Today : Start Deadline
  • 14.
  • 15.
    Reduce your risk by controlling/minimizing your risk
  • 16.
    AGILE PROJECT Featurebacklog Feature #1 Feature #2 Feature #3 Feature #4 Feature #5 Feature #6 Feature #7 Feature #8 Feature #9 Feature #10 Start Deadline Sprint Sprint Sprint Sprint Sprint Sprint Sprint
  • 17.
    AGILE PROJECT Each2-week sprint: • Prioritizes project goals • Completes a set of features • Creates a releasable product Feature backlog Feature #1 Feature #2 Feature #3 Feature #4 Feature #5 Feature #6 Feature #7 Feature #8 Feature #9 Feature #10 Start Deadline Sprint Sprint Sprint Sprint Sprint Sprint Sprint
  • 18.
    AGILE + WEB= ? Component-based design + Automated style guides
  • 19.
    STYLEGUIDE-DRIVEN DEVELOPMENT: THENEW WEB DEVELOPMENT J O H N A L B I N W I L K I N S F R O N T - E N D T R A C K — O C T O B E R 1 , 2 0 1 4
  • 20.
    STYLE GUIDE DRIVENDEVELOPMENT Only requirements are: Component-based design and Automated style guides
  • 21.
    What are wedoing wrong?
  • 22.
  • 23.
    CSS SPECIFICITY WARS .menu .item a:link {}! .sidebar .menu .item a:link {}! .page-37 .sidebar .menu .item a:link {}
  • 24.
    CSS SPECIFICITY WARS .menu .item a:link {! .sidebar & {! .page-37 & {}! }! }
  • 25.
    OVERLY GENERIC CLASSNAMES .title&{&} .block&.title&{&} .node&.title&{&} .views&.title&{&} .content&{&} .block&.content&{&} .node&.content&{&} .views&.content&{&}
  • 26.
    SEEMED LIKE AGOOD IDEA AT THE TIME
  • 27.
    WHAT IS ADESIGN COMPONENT? “Component” is the same as… ⨯ “Object” in OOCSS ⨯ “Module” in SMACSS ⨯ “Block” in BEM’s Block-Element-Modifier ⨯ “UI Pattern”
  • 28.
    CSS DESI GNCOMPONENTS ARE: ⨯ Applied to a loose collection of HTML elements ⨯ Repeatable (even if never repeated) ⨯ Specific Replace CSS specificity with specific names ⨯ Self contained Styles do not bleed onto anything else ⨯ Nest-able
  • 31.
    SMACSS 1.BASE 2.LAYOUT 3.MODULE 4.STATE 5.THEME
  • 32.
    SMACSS 1.BASE 2.LAYOUT 3.COMPONENTS 4.STATE 5.SKIN 1.BASE 2.LAYOUT 3.MODULE 4.STATE 5.THEME
  • 33.
    SMACSS 1.BASE 2.LAYOUT 3.COMPONENTS 4.STATE 5.SKIN
  • 34.
    SMACSS 1.BASE 2.LAYOUT 3.COMPONENTS 3.1.STATE 3.2.SKIN
  • 35.
    SMACSS BEM } 1.BASE 2.LAYOUT 3.COMPONENTS 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFIER 3.4.STATE 3.5.SKIN
  • 36.
    “You see, radiois a kind of a very, very long . cat.
  • 37.
    You pull histail in New York and his head is meowing in Los Angeles.
  • 38.
    Do you understandthis? You send signals here, they receive them there. The only difference is that…
  • 39.
    …there is nocat.” — Albert Einstein
  • 40.
    .flower ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFI ER 3.4.STATE 3.5.SKIN
  • 41.
    .flower_ _ petals ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFI ER 3.4.STATE 3.5.SKIN
  • 42.
    .flower_ _face .flower__stem .flower_ _leaves
  • 43.
    .flower_ _ bed ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFI ER 3.4.STATE 3.5.SKIN
  • 44.
    .flower--tulip ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFI ER 3.4.STATE 3.5.SKIN
  • 45.
    Don’t make itcomplicated .channel-tab_ _guide_ _upcoming-
  • 46.
    Don’t make itcomplicated guide_ _upcoming-video_ _info_ _time
  • 47.
    On semantic naming ⨯ Content semantics are handled by HTML5 elements ⨯ Let’s make our class names use Design semantics ⨯ Class names should be meaningful to developers and designers
  • 48.
    .flower:hover ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFIER 3.4.STATE 3.5.SKIN
  • 49.
    .flower.is-pollinating ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFIER 3.4.STATE 3.5.SKIN
  • 50.
    @media (min-width: 48em){ .flower } ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFIER 3.4.STATE 3.5.SKIN
  • 51.
    @media print {.flower } ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFIER 3.4.STATE 3.5.SKIN
  • 52.
    .is-night .flower ! 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFIER 3.4.STATE 3.5.SKIN ( global modfier )
  • 53.
    .flower An automated style guide of .flower is available: ! johnalbin.github.io/flower-power
  • 54.
    All the selectors .the3component& .the3component33modifier& .the3component__an3element& .the3component33modifier__an3element& .the3component.is3state& & .the3component:hover& & @media&all&{&.the3component&{}&}& .the3skin&.the3component
  • 55.
    CSS DESI GNCOMPONENTS ARE: ⨯ Applied to a loose collection of HTML elements ⨯ Repeatable (even if never repeated) ⨯ Specific Replace CSS specificity with specific names ⨯ Self contained Styles do not bleed onto anything else ⨯ Nest-able
  • 56.
    SMACSS BEM } 1.BASE 2.LAYOUT 3.COMPONENTS 3.1.COMPONENT 3.2.ELEMENT 3.3.MODIFIER 3.4.STATE 3.5.SKIN
  • 57.
    Drupal 8 CSScoding standards www.drupal.org/node/1886770
  • 58.
    FILE ORGANIZATION =3 SMACSS CATEGORIES
  • 59.
  • 60.
  • 61.
  • 62.
    EASY TO FINDYOUR COMPONENTS. ⨯ Inspect the DOM. ⨯ Find the CSS class on the component. ⨯ Look for a file with that name in the components folder.
  • 63.
  • 64.
    THE “Fugly” SELECTORHACK Selector in DOM I couldn’t change Class name I wish I could use in DOM
  • 65.
    AUTOMATED STYLE GUIDE kss-node github.com/kss-node/kss-node
  • 66.
  • 68.
    WHAT DID YOUTHINK? E V A U L A T E T H I S S E S S I O N - A M S T E R D A M 2 0 1 4 . D R U P A L . O R G / S C H E D U L E THANK YO U!