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

Harnessing the Power of Sass

jina
September 12, 2013

Harnessing the Power of Sass

Presented at a Salesforce UX Meetup, hosted by Desk

jina

September 12, 2013
Tweet

More Decks by jina

Other Decks in Design

Transcript

  1. “It used to be that designers made an object and

    walked away. Today the emphasis must shift to designing the entire life cycle.” —PAUL SAFFO
  2. Output ul.items a ... &:hover ... .ie-6 & ... ul.items

    a { ... } ul.items:hover { ... } .ie-6 ul.items a { ... } Sass
  3. Output ul.items a ... @media print ... ul.items { ...

    } @media print { ul.items { ... } } Sass
  4. Output .sidebar border: 1px solid #eee top-color: #fff left: 0

    .sidebar { border: 1px solid #eee; border-top-color: #fff; border-left: 0; } Sass
  5. Output $text: #444 $bg: $text body color: $text footer background:

    $bg body { color: #444; } footer { background: #444; } Sass
  6. Output =mod($txt: #ccc) background: #111 color: $txt body +mod h1

    +mod(#888) body { background: #111; color: #ccc; } h1 { background: #111; color: #888; } Sass
  7. Output .message padding: 1em a color: #369 .error @extend .message

    color: #eee .message, .error { padding: 1em; } .message a, .error a { color: #369; } .error { color: #eee; } Sass
  8. Output %grid-1 width: 240px %grid-2 width: 480px .content @extend %grid-1

    color: #369 .main @extend %grid-1 background: #eee .content, .main { width: 240px; } .content { color: #369; } .main { background: #eee; } Sass
  9. vendor/_shared.sass @import compass @import compass/layout @import susy kenobi.css.sass @import vendor/shared

    deathstar.css.sass @import bootstrap/variables @import bootstrap/mixins @import vendor/shared 01 // vendor libraries
  10. dependencies/_shared.sass @import metrics @import typography @import colors @import themes Globally

    used variables, mixins, & functions 01 // vendor libraries 02 // dependencies
  11. kenobi.css.sass @import foundation/shared @import foundation/kenobi deathstar @import foundation/shared Kenobi has

    a different font, so we override them after importing shared styles. 01 // vendor libraries 02 // dependencies 03 // foundation
  12. components/_shared.sass @import icons @import buttons @import toggles @import messages @import

    pagination Modular components & their states. 01 // vendor libraries 02 // dependencies 03 // foundation 04 // components
  13. regions/_shared.sass @import banner @import navigation @import complementary @import contentinfo Page

    regions, named after their class or role names 01 // vendor libraries 02 // dependencies 03 // foundation 04 // components 05 // regions
  14. helpers/_shared.sass @import nonsemantic-classes @import placeholder-selectors Non-semantic helpers 01 // vendor

    libraries 02 // dependencies 03 // foundation 04 // components 05 // regions 06 // helpers
  15. responsive/_shared.sass @import responsive/mobile @import responsive/tablet @import responsive/screen Adjustments to type

    sizes, grids, and images. 01 // vendor libraries 02 // dependencies 03 // foundation 04 // components 05 // regions 06 // helpers 07 // responsive
  16. <% if Rails.env.development? && Settings.show_grids %> @import tools/show-grid <% end

    %> 01 // vendor libraries 02 // dependencies 03 // foundation 04 // components 05 // regions 06 // helpers 07 // responsive 08 // tools
  17. } 01 // vendor libraries 02 // dependencies 03 //

    foundation 04 // components 05 // regions 06 // helpers 07 // responsive 08 // tools Put new CSS in the proper place. Move old CSS as you come to it. Move more CSS if you have tech debt time.
  18. $x: #369 $y: #fff .a color: lighten($x, 5%) .b color:

    darken($x, 5%) .c color: saturate($x, 5%) .e color: mix($x, $y)
  19. Create mixins for your various type styles. Small and all

    caps, big quote styles, etc. Document them.
  20. “Be regular and orderly in your life so that you

    may be violent and original in your work.” —GUSTAVE FLAUBERT