Slide 1

Slide 1 text

one file… so many sites

Slide 2

Slide 2 text

@minamarkham

Slide 3

Slide 3 text

@gdiDFW

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

I build a lot of sites.

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

One site to rule them all

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Theming Automation Documentation

Slide 16

Slide 16 text

Theming

Slide 17

Slide 17 text

File Structure

Slide 18

Slide 18 text

@import

Slide 19

Slide 19 text

01.  Utilities   @import  'global';   @import  'functions';   @import  'mixins';   @import  'helpers'; utilities/_index.scss Variables, mixins, functions, etc. Basically anything that doesn’t output CSS by itself.

Slide 20

Slide 20 text

@import  "lib/susy";   @import  "lib/font-­‐awesome";   @import  "lib/pesticide"; utilities/_lib.scss Third-party libraries such as Susy, Font Awesome, Pesticide, and other plugins. 01.  Utilities   02.  Libraries  

Slide 21

Slide 21 text

@import  ‘normalize';   @import  'base'; base/_index.scss CSS resets, Normalize, element styles 01.  Utilities   02.  Libraries   03.  Base  

Slide 22

Slide 22 text

@import  'header';   @import  'footer';   @import  'sidebar'; layout/_index.scss Grid styles, major layout components (e.g. header, footer, sidebar, etc) 01.  Utilities   02.  Libraries   03.  Base   04.  Layout  

Slide 23

Slide 23 text

@import  'btn';   @import  'table';   @import  'nav'; modules/_index.scss Individual modules, such as buttons, navigation, menus, etc. 01.  Utilities   02.  Libraries   03.  Base   04.  Layout   05.  Modules  

Slide 24

Slide 24 text

@import  'states';   @import  'touch'; states/_index.scss Describe states of being, ex: active, collapsed or hidden 01.  Utilities   02.  Libraries   03.  Base   04.  Layout   05.  Modules   06.  States  

Slide 25

Slide 25 text

utilities/_fonts.scss Web fonts imports & declarations 01.  Utilities   02.  Libraries   03.  Base   04.  Layout   05.  Modules   06.  States   07.  @font-­‐face

Slide 26

Slide 26 text

states/_print.scss Print styles 01.  Utilities   02.  Libraries   03.  Base   04.  Layout   05.  Modules   06.  States   07.  @font-­‐face   08.  Print  

Slide 27

Slide 27 text

!important

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

shame.css

Slide 30

Slide 30 text

_shame.scss

Slide 31

Slide 31 text

01.  Utilities   02.  Libraries   03.  Base   04.  Layout   05.  Modules   06.  States   07.  @font-­‐face   08.  Print   09.  Shame _shame.scss because hacks happen

Slide 32

Slide 32 text

small and readable

Slide 33

Slide 33 text

mina.so/sassyStarter

Slide 34

Slide 34 text

Variables

Slide 35

Slide 35 text

Descriptive

Slide 36

Slide 36 text

_config.scss $red : #E10E78; $black : #413F35; $purple : #F68B21; $green : #B3CB36;

Slide 37

Slide 37 text

_config.scss $red : #E10E78; $dkgray : #413F35; $purple : #F68B21; $dkpurple : #663399; $dkgreen : #B3CB36; $gray : #332421; $blackish : #121212; $kindawhite : #f3f3f3;

Slide 38

Slide 38 text

_config.scss $red : #E10E78; $dkgray : #413F35; $purple : #F68B21; $dkpurple : #663399; $dkgreen : #B3CB36; $gray : #332421; $blackish : #121212; $kindawhite : #f3f3f3;

Slide 39

Slide 39 text

_config.scss $rubineRed : #E10E78; $charcoal : #413F35; $papaya : #F68B21; $kiwi : #B3CB36;

Slide 40

Slide 40 text

_config.scss $rubineRed : #E10E78; $charcoal : #413F35; $papaya : #F68B21; $kiwi : #B3CB36;

Slide 41

Slide 41 text

Functional

Slide 42

Slide 42 text

_config.scss $color-primary : #E10E78; $color-secondary : #00B3B5; $color-success : #B3CB36;

Slide 43

Slide 43 text

_config.scss $color-primary : #E10E78; $color-secondary : #00B3B5; $color-success : #B3CB36;

Slide 44

Slide 44 text

Descriptive + Functional http://sachagreif.com/sass-color-variables/

Slide 45

Slide 45 text

_config.scss $rubineRed : #E10E78; $charcoal : #413F35; $papaya : #F68B21; $kiwi : #B3CB36; $color-primary : $rubineRed; $color-secondary : $aqua; $color-success : $kiwi;

Slide 46

Slide 46 text

Methods

Slide 47

Slide 47 text

Solution 1: Separate classes

Slide 48

Slide 48 text

.theme-border {…} .theme-background {…} .theme-button {…}

Slide 49

Slide 49 text

.theme-border {…} .theme-background {…} .theme-button {…}

Slide 50

Slide 50 text

Solution 2: Maps & Functions http://www.zell-weekeat.com/organizing-multiple-theme-styles-with-sass/

Slide 51

Slide 51 text

_config.scss $themes: ( default : #444, unilever : #f1c40f, lipton : #c0392b, epson : #8e44ad );

Slide 52

Slide 52 text

_functions.scss @function map-fetch($map, $keys) { $key: nth($keys, 1); $length: length($keys); $value: map-get($map, $key); @if $value != null { @if $length > 1 { $rest: (); @for $i from 2 through $length { $rest: append($rest, nth($keys, $i)) } @return map-fetch($value, $rest); } @else { @return $value; } } @else { @return false; } }

Slide 53

Slide 53 text

_mixins.scss @mixin theme ($themes: $themes) { @each $theme, $map in $themes { .#{$theme} & { $theme-color: map-fetch($themes, $theme "color") !global; @content; $theme-color: null !global; }}}

Slide 54

Slide 54 text

_config.scss .module { @include theme() { color: $theme-color; }}

Slide 55

Slide 55 text

_config.scss .default .module { color: red; } .unilever .module { color: orange; } .lipton .test { color: yellow; } .epson .test { color: green; }

Slide 56

Slide 56 text

_config.scss .default .module { color: red; } .unilever .module { color: orange; } .lipton .test { color: yellow; } .epson .test { color: green; }

Slide 57

Slide 57 text

Solution 3: @mixins

Slide 58

Slide 58 text

@mixin theme($name) { @if $theme == $name { @content; } }

Slide 59

Slide 59 text

$theme: rebeccapurple

Slide 60

Slide 60 text

.module { @include theme($rebeccapurple) {…} }