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

Nesting Is For The Birds

Nesting Is For The Birds

Some quick thoughts on the abuse of CSS pre-processors.

Evan Travers

August 25, 2014
Tweet

More Decks by Evan Travers

Other Decks in Programming

Transcript

  1. nesting is for the birds a few thoughts on the

    common misuse of CSS pre-processors
  2. common mistakes • matching CSS nesting to DOM structure (over

    nesting) • misuse of @include vs @extend • taking advantage of the concise syntax to spew out verbose code
  3. some goals • documented organizational scheme • understand your tools

    to minimize unnecessary code generation • keep code flat, clean
  4. what I do
 (since you asked so nicely) • small

    files, organized well into logical directories • source cleaned and organized to emphasize and highlight repetitive code • if some concept is a “base” element that could be descended from, %placeholder. Require options? @mixin. • BEM (.block__element—modifier) to break up complex DOM elements.
  5. references: • SMACSS (the base of what I use for

    code organization, I use a slightly modified form, similar to this one by Envato) • Good write-up on the difference between %placeholders, @extends, and @mixins • The best article on BEM • A *great* code guide by @mdo, I especially like the declaration order portion • Harry Robert’s http://cssguidelin.es/. I haven’t fully reviewed this one, but I’m sure it’s incredible. • images by the incomparable Jean Giraud.