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

A Modern Sass Architecture

A Modern Sass Architecture

A short talk I gave at the inaugural SassXSW in Bath on MAy 6th 2015

Stuart Robson

May 06, 2015

Transcript

77 slides
  1. BEM

  2. base/ • where you put rudimentary defaults • a reset

    file • basic typography settings • code for common HTML elements
  3. layouts/ • code that lays out the site • code

    for the main ‘parts’ of your site • header • footer • main • aside
  4. components/ • smaller parts of the site • a carousel

    (if they’re not evil, are they evil?) • accordian • tabs
  5. pages/ • for ‘page specific’ code • files named after

    the ‘page’ e.g. • _front-page.scss
  6. config/ • code that doesn’t output CSS • tools and

    helpers • mixins • variables • functions
  7. vendor/ • a good store for ‘not my code’ •

    CSS from external libraries • jquery-ui.scss • bootstrap.scss
  8. _shame.scss • somewhere to put something you’re not sure of

    • should still have comments • should be emptied routinely, and quickly
  9. file naming convention _b-reset.scss base files begin with _b- _c-tabs.scss

    components begin with _c- _l-header.scss layout files begin with _l- _p-contact.scss page files begin with _p- _t-admin.scss theme files begin with _t- _v-neat.scss vendor files begin with _v-
  10. // config/ @import "config/_variables"; … // base/ @import "base/_reset"; ...

    // components/ @import "components/_buttons"; ... // layout/ @import "layout/_navigation"; ... // pages/ @import "pages/_home"; ... // themes/ @import “themes/_logged-in“; ... // vendors/ @import "config/_jquery-ui"; ...
  11. .component { // extends // includes // variables // CSS

    // parent selector items // media queries }
  12. wrapping up • keep your Sass sane • use specific

    folders for specific elements of a site • refactor when you can • add comments like a mad person

More Decks by Stuart Robson

Other Decks in Design