On Github bengie / modular-design
Gregory Van Looy / Fronteers meetup — 22/05/2014
Freelance HTML & CSS architect/consultant @ diezjietal
I suck @ JavaScript
waarom geen front-end dev<div class="fields"> <div class="field-a" id="field-a-id-here"> <div class="field-b" id="field-b-id-here"> <div class="field-c" id="field-c-id-here"> <div class="field-d" id="field-d-id-here"> <div class="field-e" id="field-e-id-here"> <div class="field-f" id="field-f-id-here"> Lorem ipsum dolor sit amet. </div> </div> </div> </div> </div> </div> </div>
* Any resemblance to a real CMS is purely coincidental.
header nav#main-nav > ul.nav li ul li {}OK t doet zijn werk maar voor structuur, maintenance en performance .... een dikke 2/10
CSS wasn't totally neglected.
People started bulletproofing, handcrafting and hardboiling CSS.
ging meer over goede CSS schrijven, tableless design en creatieve oplossingen, alsook CSS3Every site gets bigger.
Geef toe: elke site groeit. En heb t niet over het aantal pagina's maar over de featuresTo: Gregory Van Looy From: some@designer.com Subject: Designs
Hi Greg, I've attached the design to this email.
Good luck, some designer
attachment: home-final-v2-update.jpg
hoe begin je daar aan. Veel heen en weer mails als gevolgTo: Gregory Van Looy From: some@designer.com Subject: Styleguide
Hi Greg, This is the styleguide:
Have fun, some designer
attachment: design-styleguide.psd
niet gedetailleerd genoeg, ga maar op ontdekkingTo: Gregory Van Looy From: crazy@designer.com Subject: Styleguide
Hi Greg, This is the styleguide:
Have fun, a crazy designer
attachment: Book-A-general-components.pdf attachment: Book-B-mobile-styleguide.pdf attachment: Book-C-desktop-styleguide.pdf
trop is teveel - als ge 150 paginas nodig hebt om uw design uit te leggen dan ben je verkeerd bezigul { margin-bottom: 24px; } p { margin: 18px 0; } h2 { margin-bottom: 20px; }
ul, h2 { margin-bottom: 20px; } p { margin: 20px 0; }
/* Sass */ $base-spacing-unit: 20px; ul, h2 { margin-bottom: $base-spacing-unit; } p { margin: $base-spacing-unit 0; }
p { font-size: 16px; } figcaption { font-size: 15px; } h6 { font-size: 17px; }
p, figcaption, h6 { font-size: 16px; } /* Sass */ $base-font-size: 16px; p, figcaption, h6 { font-size: $base-font-size; }
© Harry Roberts
t is niet omdat het kan, dat je het ook moet doen.article-teaser {} .carousel {} .tabs {}
.tag {} .more-link {} .icon {}
Scalable and Modular Architecture for CSS
/* no classes here, only element selectors */ body {} p {} a {}
/* grid */ .col {} .col--2 {} .col--primary {} /* layout specific: .layout-- prefix */ .layout--homepage {}
.layout--XXXX classes are added to the html tag
Biggest chunk of your CSS file
/* skip the prefix, it's too verbose */ .module-carousel {} /* that's the way, uhu uhu */ .carousel {}
/* .is- prefix */ .is-active {} .is-hidden {} .is-collapsed {} .is-expanded {}
JavaScript: easier to debug
/* .js-is- prefix */ .js-is-active {} .js-is-hidden {} .js-is-collapsed {} .js-is-expanded {}
Will you need this one?
.theme--culture .article {} .theme--x-mas blockquote:before { content: 'hohoho'; }
.theme-- classes are added to the html tag
in combination with Sass
| - sass |- base _base.scss _normalize.scss _defaults.scss _webfonts.scss ... |- layout _layout.scss _grid.scss _sections.scss ... |- modules _modules.scss _carousel.scss _pagination.scss ... |- state _state.scss ... |- theme _theme.scss _x-mas.scss ... _site-settings.scss _mixins.scss main.scss
Block - Element - Modifier
.block {} .block__element {} /* note: double underscore */ .block--modifier {} /* note: double hyphen */
header nav#main-nav > ul.nav li ul li {}
<article class="article"> <header class="article__header">...</header> <div class="article__body">...</div> <footer class="article__footer">...</footer> </article>
<!-- note: class chaining --> <article class="article article--primary"> <header class="article__header">...</header> <div class="article__body">...</div> <footer class="article__footer">...</footer> </article>
/* Bad */ .pageHeader {} .button--blue {} /* Good */ .page-header {} .button--primary {}
/* This is OK! */ .article__header--no-border {} .teaser--large--primary {}
/* old skool */ article > header {} /* old skool + Smacss theming */ .theme--x-mas article > header {} /* BEM */ .article__header {} /* BEM + SMACSS theming */ .theme--x-mas .article__header {}