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

Thinking beyond "Scalable CSS"

Thinking beyond "Scalable CSS"

Good components empower designers and engineers by letting us think only about their inputs and outputs, not their internal complexity. This is how we are working to scale our web UI work at Twitter, and to think about CSS within this model of design and development.

Nicolas Gallagher

November 17, 2014
Tweet

More Decks by Nicolas Gallagher

Other Decks in Programming

Transcript

  1. “We cannot solve our problems with the same thinking we

    used when we created them. Albert Einstein
  2. var $size = this.props.size; var $src = this.props.src var $content

    = this.props.content; ! <figure class="Photo {'Photo--' + $size}"> <span class="Photo-crop u-block"> <img src="{$src}" alt="" /> </span> <figcaption class="Photo-caption"> {$content} </figcaption> </figure>
  3. // ui-Homepage/index.js ! var Attribution = require('ui-Attribution'); var Photo =

    require('ui-Photo'); ! <Photo src="photo.jpg" size="large"> Half-Dome in Yosemite National Park <Attribution owner="necolas" /> </Photo>
  4. /** @define Photo */ ! /* root */ .Photo {}

    ! /* modifier */ .Photo--large {} ! /* private tree */ .Photo-crop {} .Photo-caption {}
  5. /** @define Photo; use strict */ ! /* root */

    .Photo {} ! /* modifier */ .Photo—-large .Attribution {} ! /* private tree */ .Photo-crop {} .Photo-caption {} BUILD ERROR postcss-bem-linter
  6. // ui-Photo/index.js ! // css-only dependencies // (extracted by webpack)

    require('suitcss-utils-display'); require('./index.css'); ! var Photo = function () {}; ! module.exports = Photo;
  7. web_modules ├── character-counter ├── store-product ├── ui-Attribution ├── ui-Button ├──

    ui-HomePage ├── ui-Photo ├── ui-ProgressBar └── ui-ReplyBox
  8. web_modules ├── character-counter ├── store-product ├── ui-Attribution ├── ui-Button ├──

    ui-HomePage ├── ui-Photo ├── ui-ProgressBar └── ui-ReplyBox
  9. “…scientific and technical work is made invisible by its own

    success. Bruno Latour (Sociologist of science)