Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Real-Life Journey into the Opinionated World ...

A Real-Life Journey into the Opinionated World of "Utility-First" CSS

Everyone loves writing CSS. It's fun! Maintaining a CSS codebase at scale is another story. A few tight deadlines and quick shortcuts, and whoops - you find yourself in the dreaded “append only stylesheet” situation.

Utility classes to the rescue! Keep an open mind, and let's embark on a real-life journey into the controversial, emotional and highly opinionated World of “utility-first” CSS.

Simon Vrachliotis

September 27, 2018
Tweet

More Decks by Simon Vrachliotis

Other Decks in Programming

Transcript

  1. “ @simonswiss - Dick Fosbury I was told over and

    over again that I would never be successful.
  2. “ @simonswiss - Dick Fosbury All I could do was

    shrug and say: “We’ll just have to see”.
  3. “ @simonswiss – Adam Morse, “CSS and Scalability” The best

    way to maintain CSS is to stop writing CSS.
  4. @simonswiss Big Hero Title This is a small headline just

    to make the hero look relatively good. Remove top padding More changes coming…
  5. Big Hero Title This is a small headline just to

    make the hero look relatively good. Remove top padding Ugh… I wish! Can’t use that!
  6. “ @simonswiss – Adam Wathan, "CSS utility classes and 'separation

    of concerns'" I see the relationship between HTML and CSS as a dependency direction.
  7. “ @simonswiss – Adam Wathan, "CSS utility classes and 'separation

    of concerns'" I see the relationship between HTML and CSS as a dependency direction. A tw o-w a y street!
  8. HTML CAN BE RE-STLYED AT WILL CSS CAN BE RE-USED

    AT WILL DECOUPLED! DECOUPLED! CSS IS TIED TO THE HTML AND NOT RE-USABLE HTML IS TIED TO THE CSS AND CANNOT BE NOT RE-STYLED NOT DECOUPLED NOT DECOUPLED “SEMANTIC” CLASSNAMES PRESENTATIONAL CLASSNAMES @simonswiss
  9. @simonswiss custom custom custom Utilities Utilities Utilities Utilities Utilities Utilities

    Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities
  10. @simonswiss BEM BEM BEM Utilities Utilities Utilities Utilities Utilities Utilities

    Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities Utilities
  11. @simonswiss BEM BEM BEM BEM BEM BEM BEM BEM BEM

    BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM BEM
  12. “ @simonswiss – Nicolas Gallagher, “About HTML semantics and front-end

    architecture” To reduce the amount of writing and editing CSS, you must accept to spend more time changing HTML classes on elements to change their styles.
  13. “ @simonswiss – Nicolas Gallagher, “About HTML semantics and front-end

    architecture” This turns out to be fairly practical. Anyone can rearrange pre-built “lego blocks”, but no one can perform CSS-alchemy.
  14. @simonswiss Articles & websites Let There Be Peace On CSS

    CSS and Scalability About HTML Semantics and Front End Architecture CSS Utility Classes and "Separation of Concerns" Naming CSS Stuff Is Really Hard DWYL/Learn Tachyons CSS Zen Garden Libraries & frameworks Tachyons Tailwind CSS Flexbox Grid Further reading The Case for Atomic CSS How is Tachyons Different From Inline Styles? Don't Write CSS, Configure it With Tailwind