Slide 1

Slide 1 text

SASS, EXTENDS & PLACEHOLDER CLASSES it’s like ninjas in your code

Slide 2

Slide 2 text

SASS, EXTENDS & PLACEHOLDER CLASSES it’s like ninjas in your code

Slide 3

Slide 3 text

That’s me! I w ork here! S U B S T A N T I A L

Slide 4

Slide 4 text

That’s me! @ANOTHERUIGUY @SASSMEETUP On the Twitters

Slide 5

Slide 5 text

OOCSS FRAMEWORKS attempts at creating ‘objects’ to streamline application

Slide 6

Slide 6 text

OOCSS TEACHES US ... create ‘objects’ • Identify reusable objects • Be semantic w/HTML • Minimize selectors • Extend your classes • ‘Style’ separate from content • ‘Content’ separate from container

Slide 7

Slide 7 text

OOCSS TEACHES US ... create ‘objects’ • Identify reusable objects • Be semantic w/HTML • Minimize selectors • Extend your classes • ‘Style’ separate from content • ‘Content’ separate from container

Slide 8

Slide 8 text

OOCSS TEACHES US ... create ‘objects’ • Identify reusable objects • Be semantic w/HTML • Minimize selectors • Extend your classes • ‘Style’ separate from content • ‘Content’ separate from container DUH!

Slide 9

Slide 9 text

OOCSS FRAMEWORKS attempts to automate OOCSS CSS frameworks have been using OOCSS methods since inception. Where these fail is the insane amount of CSS selectors that by default are added to the site’s CSS. From grid systems to UI elements, CSS bloat is a real issue.

Slide 10

Slide 10 text

OOCSS FRAMEWORKS attempts to automate OOCSS CSS frameworks have been using OOCSS methods since inception. Where these fail is the insane amount of CSS selectors that by default are added to the site’s CSS. From grid systems to UI elements, CSS bloat is a real issue. Twitter’s bootstrap default includes 4914 lines of CSS.

Slide 11

Slide 11 text

OOCSS FRAMEWORKS attempts to automate OOCSS CSS frameworks have been using OOCSS methods since inception. Where these fail is the insane amount of CSS selectors that by default are added to the site’s CSS. From grid systems to UI elements, CSS bloat is a real issue. Twitter’s bootstrap default includes 4914 lines of CSS.

Slide 12

Slide 12 text

DRY CODING find the pattern and Don’t Repeat Yourself 9 out of 10 developers agree that using a DRY method of coding will save your bacon in the long run.

Slide 13

Slide 13 text

BOOTSTRAP BUTTONS let’s look at some code

Slide 14

Slide 14 text

OOCSS TEACHES US ... create ‘objects’ .nav-tabs:before, .nav-pills:before, .nav-tabs:after, .nav-pills:after { display: table; content: ""; } .nav-tabs:after, .nav-pills:after { clear: both; }

Slide 15

Slide 15 text

OOCSS TEACHES US ... create ‘objects’ .nav-tabs:before, .nav-pills:before, .nav-tabs:after, .nav-pills:after { display: table; content: ""; } .nav-tabs:after, .nav-pills:after { clear: both; } How much CSS can it really be? It’s just for .nav-tabs and .nav-pills

Slide 16

Slide 16 text

} .nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, .nav > li.dropdown.open.active > a:hover { color: #ffffff; background-color: #999999; border-color: #999999; } .nav li.dropdown.open .caret, .nav li.dropdown.open.active .caret, .nav li.dropdown.open a:hover .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100); }

Slide 17

Slide 17 text

} .nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, .nav > li.dropdown.open.active > a:hover { color: #ffffff; background-color: #999999; border-color: #999999; } .nav li.dropdown.open .caret, .nav li.dropdown.open.active .caret, .nav li.dropdown.open a:hover .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100); } Dude, that’s a lot of code!

Slide 18

Slide 18 text

} .nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, .nav > li.dropdown.open.active > a:hover { color: #ffffff; background-color: #999999; border-color: #999999; } .nav li.dropdown.open .caret, .nav li.dropdown.open.active .caret, .nav li.dropdown.open a:hover .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100); } Dude, that’s a lot of code! That’s line 169 right there.

Slide 19

Slide 19 text

} .nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, .nav > li.dropdown.open.active > a:hover { color: #ffffff; background-color: #999999; border-color: #999999; } .nav li.dropdown.open .caret, .nav li.dropdown.open.active .caret, .nav li.dropdown.open a:hover .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100); } Dude, that’s a lot of code! That’s line 169 right there. This makes baby kitties cry

Slide 20

Slide 20 text

} .nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, .nav > li.dropdown.open.active > a:hover { color: #ffffff; background-color: #999999; border-color: #999999; } .nav li.dropdown.open .caret, .nav li.dropdown.open.active .caret, .nav li.dropdown.open a:hover .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100); } Dude, that’s a lot of code! That’s line 169 right there. Face it, CSS is NOT DRY! This makes baby kitties cry

Slide 21

Slide 21 text

} .nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, .nav > li.dropdown.open.active > a:hover { color: #ffffff; background-color: #999999; border-color: #999999; } .nav li.dropdown.open .caret, .nav li.dropdown.open.active .caret, .nav li.dropdown.open a:hover .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100); } Dude, that’s a lot of code! That’s line 169 right there. Face it, CSS is NOT DRY! 10 references of #ffffff in this example alone This makes baby kitties cry

Slide 22

Slide 22 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM

Slide 23

Slide 23 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM Markup with ‘object’ classes

Slide 24

Slide 24 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM Markup with ‘object’ classes here

Slide 25

Slide 25 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM Markup with ‘object’ classes here here

Slide 26

Slide 26 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM Markup with ‘object’ classes here here here

Slide 27

Slide 27 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM Markup with ‘object’ classes here here here here

Slide 28

Slide 28 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM Markup with ‘object’ classes here here here here here

Slide 29

Slide 29 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM Markup with ‘object’ classes here here here here here here

Slide 30

Slide 30 text

OOCSS TEACHES US ... create CSS ‘objects’ & apply/extend in the DOM Markup with ‘object’ classes here here here here here here & here

Slide 31

Slide 31 text

OOCSS BUTTONS twitter bootstrap classes for buttons .btn { display: inline-block; *display: inline; padding: 4px 10px 4px; margin-bottom: 0; *margin-left: .3em; font-size: 13px; line-height: 18px; *line-height: 20px; color: #333333; text-align: center; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); vertical-align: middle; cursor: pointer; background-color: #f5f5f5; *background-color: #e6e6e6; background-image: -ms- linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit- gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit- linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear- gradient(top, #ffffff, #e6e6e6); background-image: linear- gradient(top, #ffffff, #e6e6e6); background-image: -moz- linear-gradient(top, #ffffff, .btn:hover { color: #333333; text-decoration: none; background-color: #e6e6e6; *background-color: #d9d9d9; /* Buttons in IE7 don't get borders, so darken on hover */ background-position: 0 -15px; -webkit-transition: background-position 0.1s linear; -moz-transition: background- position 0.1s linear; -ms-transition: background- position 0.1s linear; -o-transition: background- position 0.1s linear; transition: background- position 0.1s linear; } .btn:focus { outline: thin dotted #333; outline: 5px auto -webkit- focus-ring-color; outline-offset: -2px; } .btn.active, .btn:active { .btn-mini { padding: 2px 6px; font-size: 11px; line-height: 14px; } .btn-primary, .btn-primary:hover, .btn-warning, .btn-warning:hover, .btn-danger, .btn-danger:hover, .btn-success, .btn-success:hover, .btn-info, .btn-info:hover, .btn-inverse, .btn-inverse:hover { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .btn-primary.active, .btn-warning.active, .btn-danger.active, .btn-success.active, .btn-info.active, .btn-inverse.active { color: rgba(255, 255, 255, 0.75); } filter: progid:dximagetransform.micro soft.gradient(startColorstr='#62 c462', endColorstr='#51a351', GradientType=0); filter: progid:dximagetransform.micro soft.gradient(enabled=false); } .btn-success:hover, .btn-success:active, .btn-success.active, .btn-success.disabled, .btn-success[disabled] { background-color: #51a351; *background-color: #499249; } .btn-success:active, .btn-success.active { background-color: #408140 \9; } // ----------------------------------- .btn-large { padding: 9px 14px; font-size: 15px; line-height: normal; -webkit-border-radius: 5px; -moz-border-radius: 5px;

Slide 32

Slide 32 text

border-bottom-color: #b3b3b3; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; filter: progid:dximagetransform.micro soft.gradient(startColorstr='#fffff f', endColorstr='#e6e6e6', GradientType=0); filter: progid:dximagetransform.micro soft.gradient(enabled=false); *zoom: 1; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn:hover, .btn:active, .btn.active, .btn.disabled, .btn[disabled] { background-color: #e6e6e6; *background-color: #d9d9d9; } .btn:active, .btn.active { background-color: #cccccc \9; } .btn:first-child { *margin-left: 0; } 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn.disabled, .btn[disabled] { cursor: default; background-color: #e6e6e6; background-image: none; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .btn-large { padding: 9px 14px; font-size: 15px; line-height: normal; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } .btn-large [class^="icon-"] { margin-top: 1px; } .btn-small { padding: 5px 9px; font-size: 11px; line-height: 16px; } .btn-small [class^="icon-"] { margin-top: -1px; } .btn-success, .btn-success:hover { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .btn-success.active { color: rgba(255, 255, 255, 0.75); } .btn-success { background-color: #5bb75b; *background-color: #51a351; background-image: -ms- linear-gradient(top, #62c462, #51a351); background-image: -webkit- gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); background-image: -webkit- linear-gradient(top, #62c462, #51a351); background-image: -o-linear- gradient(top, #62c462, #51a351); background-image: -moz- linear-gradient(top, #62c462, #51a351); background-image: linear- gradient(top, #62c462, #51a351); background-repeat: repeat-x; border-color: #51a351 #51a351 #387038; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); large { *padding-top: 7px; *padding-bottom: 7px; } .btn-group > .btn- large.dropdown-toggle { padding-right: 12px; padding-left: 12px; } .btn-large .caret { margin-top: 6px; border-top-width: 5px; border-right-width: 5px; border-left-width: 5px; } .dropup .btn-large .caret { border-top: 0; border-bottom: 5px solid #000000; } // ------------------------------------- .icon-white { background-image: url("../img/ glyphicons-halflings- white.png"); } .icon-off { background-position: -384px 0; } I’ve decided to update all the buttons.

Slide 33

Slide 33 text

border-bottom-color: #b3b3b3; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; filter: progid:dximagetransform.micro soft.gradient(startColorstr='#fffff f', endColorstr='#e6e6e6', GradientType=0); filter: progid:dximagetransform.micro soft.gradient(enabled=false); *zoom: 1; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn:hover, .btn:active, .btn.active, .btn.disabled, .btn[disabled] { background-color: #e6e6e6; *background-color: #d9d9d9; } .btn:active, .btn.active { background-color: #cccccc \9; } .btn:first-child { *margin-left: 0; } 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn.disabled, .btn[disabled] { cursor: default; background-color: #e6e6e6; background-image: none; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .btn-large { padding: 9px 14px; font-size: 15px; line-height: normal; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } .btn-large [class^="icon-"] { margin-top: 1px; } .btn-small { padding: 5px 9px; font-size: 11px; line-height: 16px; } .btn-small [class^="icon-"] { margin-top: -1px; } .btn-success, .btn-success:hover { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .btn-success.active { color: rgba(255, 255, 255, 0.75); } .btn-success { background-color: #5bb75b; *background-color: #51a351; background-image: -ms- linear-gradient(top, #62c462, #51a351); background-image: -webkit- gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); background-image: -webkit- linear-gradient(top, #62c462, #51a351); background-image: -o-linear- gradient(top, #62c462, #51a351); background-image: -moz- linear-gradient(top, #62c462, #51a351); background-image: linear- gradient(top, #62c462, #51a351); background-repeat: repeat-x; border-color: #51a351 #51a351 #387038; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); large { *padding-top: 7px; *padding-bottom: 7px; } .btn-group > .btn- large.dropdown-toggle { padding-right: 12px; padding-left: 12px; } .btn-large .caret { margin-top: 6px; border-top-width: 5px; border-right-width: 5px; border-left-width: 5px; } .dropup .btn-large .caret { border-top: 0; border-bottom: 5px solid #000000; } // ------------------------------------- .icon-white { background-image: url("../img/ glyphicons-halflings- white.png"); } .icon-off { background-position: -384px 0; } I’ve decided to update all the buttons.

Slide 34

Slide 34 text

WE WANT OUR CAKE and eat it too

Slide 35

Slide 35 text

PRESENTATIONAL V SEMANTIC looks good and have meaning too

Slide 36

Slide 36 text

PRESENTATIONAL V SEMANTIC looks good and have meaning too CSS needs to convey design!

Slide 37

Slide 37 text

PRESENTATIONAL V SEMANTIC looks good and have meaning too CSS needs to convey design! CSS needs to have semantic meaning!

Slide 38

Slide 38 text

PRESENTATIONAL V SEMANTIC looks good and have meaning too Managing presentational and semantic classes with vanilla CSS ... about as realistic as Ice Man getting a top 10 hit. That’s why I remodel homes YO! No, really. Google it! sass sass baby Toooo cold!

Slide 39

Slide 39 text

OOCSS

Slide 40

Slide 40 text

let’s look at a real ‘object’ solution OO CSS S

Slide 41

Slide 41 text

PLACEHOLDER CLASSES take everything you know and set it on fire!

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

! ! !

Article header

! !

Pariatur Austin adipisicing, biodiesel voluptate beard four loko vegan sapiente retro readymade labore wes anderson irony. PBR cillum sriracha dolor, beard irony shoreditch laborum. Wayfarers gastropub nihil stumptown kogi. Artisan wolf aute cred. Readymade esse in four loko swag. Thundercats mlkshk dolor sriracha, semiotics gentrify authentic sustainable bicycle rights delectus typewriter esse tofu deserunt ethnic. Tattooed VHS sunt adipisicing qui, viral typewriter artisan pitchfork ad bicycle rights gentrify pork belly aliquip.

! ! Read more ! !
OOCSS that’s a lot of classes :0

Slide 44

Slide 44 text

! ! !

Article header

! !

Pariatur Austin adipisicing, biodiesel voluptate beard four loko vegan sapiente retro readymade labore wes anderson irony. PBR cillum sriracha dolor, beard irony shoreditch laborum. Wayfarers gastropub nihil stumptown kogi. Artisan wolf aute cred. Readymade esse in four loko swag. Thundercats mlkshk dolor sriracha, semiotics gentrify authentic sustainable bicycle rights delectus typewriter esse tofu deserunt ethnic. Tattooed VHS sunt adipisicing qui, viral typewriter artisan pitchfork ad bicycle rights gentrify pork belly aliquip.

! ! Read more ! !
OOCSS that’s a lot of classes :0 1

Slide 45

Slide 45 text

! ! !

Article header

! !

Pariatur Austin adipisicing, biodiesel voluptate beard four loko vegan sapiente retro readymade labore wes anderson irony. PBR cillum sriracha dolor, beard irony shoreditch laborum. Wayfarers gastropub nihil stumptown kogi. Artisan wolf aute cred. Readymade esse in four loko swag. Thundercats mlkshk dolor sriracha, semiotics gentrify authentic sustainable bicycle rights delectus typewriter esse tofu deserunt ethnic. Tattooed VHS sunt adipisicing qui, viral typewriter artisan pitchfork ad bicycle rights gentrify pork belly aliquip.

! ! Read more ! !
OOCSS that’s a lot of classes :0 1 2

Slide 46

Slide 46 text

! ! !

Article header

! !

Pariatur Austin adipisicing, biodiesel voluptate beard four loko vegan sapiente retro readymade labore wes anderson irony. PBR cillum sriracha dolor, beard irony shoreditch laborum. Wayfarers gastropub nihil stumptown kogi. Artisan wolf aute cred. Readymade esse in four loko swag. Thundercats mlkshk dolor sriracha, semiotics gentrify authentic sustainable bicycle rights delectus typewriter esse tofu deserunt ethnic. Tattooed VHS sunt adipisicing qui, viral typewriter artisan pitchfork ad bicycle rights gentrify pork belly aliquip.

! ! Read more ! !
OOCSS that’s a lot of classes :0 1 2 3

Slide 47

Slide 47 text

! ! !

Article header

! !

Pariatur Austin adipisicing, biodiesel voluptate beard four loko vegan sapiente retro readymade labore wes anderson irony. PBR cillum sriracha dolor, beard irony shoreditch laborum. Wayfarers gastropub nihil stumptown kogi. Artisan wolf aute cred. Readymade esse in four loko swag. Thundercats mlkshk dolor sriracha, semiotics gentrify authentic sustainable bicycle rights delectus typewriter esse tofu deserunt ethnic. Tattooed VHS sunt adipisicing qui, viral typewriter artisan pitchfork ad bicycle rights gentrify pork belly aliquip.

! ! Read more ! !
OOCSS that’s a lot of classes :0 1 2 3 4

Slide 48

Slide 48 text

! ! !

Article header

! !

Pariatur Austin adipisicing, biodiesel voluptate beard four loko vegan sapiente retro readymade labore wes anderson irony. PBR cillum sriracha dolor, beard irony shoreditch laborum. Wayfarers gastropub nihil stumptown kogi. Artisan wolf aute cred. Readymade esse in four loko swag. Thundercats mlkshk dolor sriracha, semiotics gentrify authentic sustainable bicycle rights delectus typewriter esse tofu deserunt ethnic. Tattooed VHS sunt adipisicing qui, viral typewriter artisan pitchfork ad bicycle rights gentrify pork belly aliquip.

! ! Read more ! !
OOCSS that’s a lot of classes :0 1 2 3 4 5

Slide 49

Slide 49 text

! ! !

Article header

! !

Pariatur Austin adipisicing, biodiesel voluptate beard four loko vegan sapiente retro readymade labore wes anderson irony. PBR cillum sriracha dolor, beard irony shoreditch laborum. Wayfarers gastropub nihil stumptown kogi. Artisan wolf aute cred. Readymade esse in four loko swag. Thundercats mlkshk dolor sriracha, semiotics gentrify authentic sustainable bicycle rights delectus typewriter esse tofu deserunt ethnic. Tattooed VHS sunt adipisicing qui, viral typewriter artisan pitchfork ad bicycle rights gentrify pork belly aliquip.

! ! Read more ! !
OOCSS that’s a lot of classes :0 1 2 3 4 5 6

Slide 50

Slide 50 text

.post_summary { ! width: 480 / 12 * 1em; ! box-sizing: border-box; ! padding: 2em; ! margin: 1em 10 / 16 * 1em 1em 0; ! box-shadow: 0 0 30px transparentize(#000, 0.5); } .post_border { ! border: 2px solid transparentize(#000, 0.7); ! border-radius: 15 / 16 * 1em; } .post_header { ! font-family: "Arial Narrow"; ! font-weight: lighter; } .post_button { ! font-size: 1.5em; ! display: inline-block; ! font-weight: bold; ! color: white; ! text-shadow: 0 0 3px transparentize(#000, 0.5); ! padding: 10px; ! border-radius: 5px; ! border: 1px solid darken(#cdeb8e, 50%); ! text-decoration: none; } .primary_post_button { ! background: -webkit-linear-gradient(top, #cdeb8e 0%,#a5c956 100%); ! &:hover { ! ! background: -webkit-linear-gradient(top, lighten(#cdeb8e, 10%) 0%,lighten(#a5c956, 10%) 100%); ! } ! &:active { ! ! background: -webkit-linear-gradient(top, #a5c956 0%,#cdeb8e 100%); ! } } OOCSS mixing presentational and semantic CSS

Slide 51

Slide 51 text

.post_summary { ! width: 480 / 12 * 1em; ! box-sizing: border-box; ! padding: 2em; ! margin: 1em 10 / 16 * 1em 1em 0; ! box-shadow: 0 0 30px transparentize(#000, 0.5); } .post_border { ! border: 2px solid transparentize(#000, 0.7); ! border-radius: 15 / 16 * 1em; } .post_header { ! font-family: "Arial Narrow"; ! font-weight: lighter; } .post_button { ! font-size: 1.5em; ! display: inline-block; ! font-weight: bold; ! color: white; ! text-shadow: 0 0 3px transparentize(#000, 0.5); ! padding: 10px; ! border-radius: 5px; ! border: 1px solid darken(#cdeb8e, 50%); ! text-decoration: none; } .primary_post_button { ! background: -webkit-linear-gradient(top, #cdeb8e 0%,#a5c956 100%); ! &:hover { ! ! background: -webkit-linear-gradient(top, lighten(#cdeb8e, 10%) 0%,lighten(#a5c956, 10%) 100%); ! } ! &:active { ! ! background: -webkit-linear-gradient(top, #a5c956 0%,#cdeb8e 100%); ! } } OOCSS mixing presentational and semantic CSS Manually extending in vanilla CSS is really confusing!

Slide 52

Slide 52 text

.post_summary { ! width: 480 / 12 * 1em; ! box-sizing: border-box; ! padding: 2em; ! margin: 1em 10 / 16 * 1em 1em 0; ! box-shadow: 0 0 30px transparentize(#000, 0.5); } .post_border { ! border: 2px solid transparentize(#000, 0.7); ! border-radius: 15 / 16 * 1em; } .post_header { ! font-family: "Arial Narrow"; ! font-weight: lighter; } .post_button { ! font-size: 1.5em; ! display: inline-block; ! font-weight: bold; ! color: white; ! text-shadow: 0 0 3px transparentize(#000, 0.5); ! padding: 10px; ! border-radius: 5px; ! border: 1px solid darken(#cdeb8e, 50%); ! text-decoration: none; } .primary_post_button { ! background: -webkit-linear-gradient(top, #cdeb8e 0%,#a5c956 100%); ! &:hover { ! ! background: -webkit-linear-gradient(top, lighten(#cdeb8e, 10%) 0%,lighten(#a5c956, 10%) 100%); ! } ! &:active { ! ! background: -webkit-linear-gradient(top, #a5c956 0%,#cdeb8e 100%); ! } } OOCSS mixing presentational and semantic CSS Manually extending in vanilla CSS is really confusing! Especially when there are 1419 line of code :0

Slide 53

Slide 53 text

.post_summary { ! width: 480 / 12 * 1em; ! box-sizing: border-box; ! padding: 2em; ! margin: 1em 10 / 16 * 1em 1em 0; ! box-shadow: 0 0 30px transparentize(#000, 0.5); } .post_border { ! border: 2px solid transparentize(#000, 0.7); ! border-radius: 15 / 16 * 1em; } .post_header { ! font-family: "Arial Narrow"; ! font-weight: lighter; } .post_button { ! font-size: 1.5em; ! display: inline-block; ! font-weight: bold; ! color: white; ! text-shadow: 0 0 3px transparentize(#000, 0.5); ! padding: 10px; ! border-radius: 5px; ! border: 1px solid darken(#cdeb8e, 50%); ! text-decoration: none; } .primary_post_button { ! background: -webkit-linear-gradient(top, #cdeb8e 0%,#a5c956 100%); ! &:hover { ! ! background: -webkit-linear-gradient(top, lighten(#cdeb8e, 10%) 0%,lighten(#a5c956, 10%) 100%); ! } ! &:active { ! ! background: -webkit-linear-gradient(top, #a5c956 0%,#cdeb8e 100%); ! } } OOCSS mixing presentational and semantic CSS Manually extending in vanilla CSS is really confusing! IMHO, extending classes like this in the DOM sucks! Especially when there are 1419 line of code :0

Slide 54

Slide 54 text

! Read more ! ! OO’S’CSS using semantic classes on the block

Slide 55

Slide 55 text

! Read more ! ! OO’S’CSS using semantic classes on the block Conveys simple meaning about the block.

Slide 56

Slide 56 text

! Read more ! ! OO’S’CSS using semantic classes on the block Conveys simple meaning about the block. Any redesign hinges off of editing one class in the CSS

Slide 57

Slide 57 text

! Read more ! ! OO’S’CSS using semantic classes on the block Conveys simple meaning about the block. Any redesign hinges off of editing one class in the CSS No need to edit the markup. That’s cool!

Slide 58

Slide 58 text

=default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border =default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em =post_header font-family: "Arial Narrow" font-weight: lighter =button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none =primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary +default_block h1 +post_header a +button +primary_button OO’S’CSS @mixin is a cool tool ...

Slide 59

Slide 59 text

=default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border =default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em =post_header font-family: "Arial Narrow" font-weight: lighter =button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none =primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary +default_block h1 +post_header a +button +primary_button OO’S’CSS @mixin is a cool tool ... Mixins are never processed into CSS until used.

Slide 60

Slide 60 text

=default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border =default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em =post_header font-family: "Arial Narrow" font-weight: lighter =button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none =primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary +default_block h1 +post_header a +button +primary_button OO’S’CSS @mixin is a cool tool ... Mixins are never processed into CSS until used. Mixins are MUCH EASIER to reuse then standard CSS.

Slide 61

Slide 61 text

=default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border =default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em =post_header font-family: "Arial Narrow" font-weight: lighter =button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none =primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary +default_block h1 +post_header a +button +primary_button OO’S’CSS @mixin is a cool tool ... We have combined all these ‘object’ mixins into a nice module. Mixins are never processed into CSS until used. Mixins are MUCH EASIER to reuse then standard CSS.

Slide 62

Slide 62 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary h1 { ! font-family: "Arial Narrow"; ! font-weight: lighter; } .post_summary a { ! font-size: 1.5em; ! display: inline-block; ! font-weight: bold; ! color: white; ! text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); ! padding: 10px; ! border-radius: 5px; ! border: 1px solid #4c6812; ! text-decoration: none; ! background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { ! background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { ! background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS the robot will copy and paste

Slide 63

Slide 63 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary h1 { ! font-family: "Arial Narrow"; ! font-weight: lighter; } .post_summary a { ! font-size: 1.5em; ! display: inline-block; ! font-weight: bold; ! color: white; ! text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); ! padding: 10px; ! border-radius: 5px; ! border: 1px solid #4c6812; ! text-decoration: none; ! background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { ! background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { ! background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS the robot will copy and paste This is really clean and looks awesome right?

Slide 64

Slide 64 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary h1 { ! font-family: "Arial Narrow"; ! font-weight: lighter; } .post_summary a { ! font-size: 1.5em; ! display: inline-block; ! font-weight: bold; ! color: white; ! text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); ! padding: 10px; ! border-radius: 5px; ! border: 1px solid #4c6812; ! text-decoration: none; ! background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { ! background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { ! background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS the robot will copy and paste This is really clean and looks awesome right? But for reuse, this method will 100% duplicate all the CSS under a new selector

Slide 65

Slide 65 text

.post_summary { @include default_block; h1 { @include post_header; } a { @include button; @include primary_button; } } .main_article { @include default_block; h3 { @include post_header; } } button { @include button; @include primary_button; } OO’S’CSS the robot will copy and paste

Slide 66

Slide 66 text

.post_summary { @include default_block; h1 { @include post_header; } a { @include button; @include primary_button; } } .main_article { @include default_block; h3 { @include post_header; } } button { @include button; @include primary_button; } OO’S’CSS the robot will copy and paste THIS IS GREAT!

Slide 67

Slide 67 text

.post_summary { @include default_block; h1 { @include post_header; } a { @include button; @include primary_button; } } .main_article { @include default_block; h3 { @include post_header; } } button { @include button; @include primary_button; } OO’S’CSS the robot will copy and paste THIS IS GREAT! REALLY REUSING SOME CODE!

Slide 68

Slide 68 text

.post_summary { @include default_block; h1 { @include post_header; } a { @include button; @include primary_button; } } .main_article { @include default_block; h3 { @include post_header; } } button { @include button; @include primary_button; } OO’S’CSS the robot will copy and paste THIS IS GREAT! REALLY REUSING SOME CODE! OH MAN! THIS IS SOOOO DRY!

Slide 69

Slide 69 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } .main_article { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .main_article h3 { font-family: "Arial Narrow"; font-weight: lighter; } button { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } button:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } button:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS the robot will copy and paste

Slide 70

Slide 70 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } .main_article { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .main_article h3 { font-family: "Arial Narrow"; font-weight: lighter; } button { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } button:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } button:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS the robot will copy and paste

Slide 71

Slide 71 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } .main_article { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .main_article h3 { font-family: "Arial Narrow"; font-weight: lighter; } button { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } button:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } button:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS the robot will copy and paste

Slide 72

Slide 72 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } .main_article { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .main_article h3 { font-family: "Arial Narrow"; font-weight: lighter; } button { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } button:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } button:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS the robot will copy and paste

Slide 73

Slide 73 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } .main_article { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .main_article h3 { font-family: "Arial Narrow"; font-weight: lighter; } button { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; background: -webkit-linear-gradient(top, #cdeb8e 0%, #a5c956 100%); } button:hover { background: -webkit-linear-gradient(top, #e0f3b9 0%, #bad57d 100%); } button:active { background: -webkit-linear-gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS the robot will copy and paste

Slide 74

Slide 74 text

.default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend .default_border .default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter .button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none .primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary @extend .default_block h1 @extend .post_header a @extend .button @extend .primary_button OO’S’CSS @extend is pretty awesome ...

Slide 75

Slide 75 text

.default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend .default_border .default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter .button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none .primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary @extend .default_block h1 @extend .post_header a @extend .button @extend .primary_button OO’S’CSS @extend is pretty awesome ... We have combined all these ‘object’ classes into a nice module ...

Slide 76

Slide 76 text

.default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend .default_border .default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter .button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none .primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary @extend .default_block h1 @extend .post_header a @extend .button @extend .primary_button OO’S’CSS @extend is pretty awesome ... ... but all these classes will get processed into the CSS? We have combined all these ‘object’ classes into a nice module ...

Slide 77

Slide 77 text

.default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend .default_border .default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter .button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none .primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary @extend .default_block h1 @extend .post_header a @extend .button @extend .primary_button OO’S’CSS @extend is pretty awesome ... ... but all these classes will get processed into the CSS? We have combined all these ‘object’ classes into a nice module ... so we have presentational classes for no reason but to be extended by semantic ones?

Slide 78

Slide 78 text

.default_block, .post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .default_border, .default_block, .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_header, .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .button, .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .primary_button, .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .primary_button:hover, .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .primary_button:active, .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS our processed CSS

Slide 79

Slide 79 text

.default_block, .post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .default_border, .default_block, .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_header, .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .button, .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .primary_button, .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .primary_button:hover, .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .primary_button:active, .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS our processed CSS OOCSS class

Slide 80

Slide 80 text

.default_block, .post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .default_border, .default_block, .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_header, .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .button, .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .primary_button, .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .primary_button:hover, .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .primary_button:active, .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS our processed CSS OOCSS class Semantic class

Slide 81

Slide 81 text

.default_block, .post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .default_border, .default_block, .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_header, .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .button, .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .primary_button, .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .primary_button:hover, .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .primary_button:active, .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS our processed CSS OOCSS class Semantic class OOCSS class

Slide 82

Slide 82 text

.default_block, .post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .default_border, .default_block, .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_header, .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .button, .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .primary_button, .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .primary_button:hover, .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .primary_button:active, .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS our processed CSS OOCSS class Semantic class OOCSS class Semantic class

Slide 83

Slide 83 text

.default_block, .post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .default_border, .default_block, .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_header, .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .button, .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .primary_button, .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .primary_button:hover, .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .primary_button:active, .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS our processed CSS OOCSS class Semantic class OOCSS class Semantic class OOCSS class

Slide 84

Slide 84 text

.default_block, .post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .default_border, .default_block, .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_header, .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .button, .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .primary_button, .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .primary_button:hover, .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .primary_button:active, .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS our processed CSS OOCSS class Semantic class OOCSS class Semantic class OOCSS class Semantic class

Slide 85

Slide 85 text

.default_block, .post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .default_border, .default_block, .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_header, .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .button, .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .primary_button, .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .primary_button:hover, .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .primary_button:active, .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS our processed CSS OOCSS class Semantic class OOCSS class Semantic class OOCSS class Semantic class

Slide 86

Slide 86 text

#1 COMPLAINT all these classes, they exist even if I don’t use them ;(

Slide 87

Slide 87 text

W/PLACEHOLDER CLASSES they don’t exist until you want them to

Slide 88

Slide 88 text

%default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em %post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary @extend %default_block h1 @extend %post_header a @extend %button @extend %primary_button OO’S’CSS the way of the future!

Slide 89

Slide 89 text

%default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em %post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary @extend %default_block h1 @extend %post_header a @extend %button @extend %primary_button OO’S’CSS the way of the future! % is all the magic

Slide 90

Slide 90 text

%default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em %post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary @extend %default_block h1 @extend %post_header a @extend %button @extend %primary_button OO’S’CSS the way of the future! % is all the magic None of these ‘silent classes’ will be in the CSS

Slide 91

Slide 91 text

%default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em %post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) .post_summary @extend %default_block h1 @extend %post_header a @extend %button @extend %primary_button OO’S’CSS the way of the future! % is all the magic None of these ‘silent classes’ will be in the CSS We have combined all these ‘object’ classes into a nice module.

Slide 92

Slide 92 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS silent classes processed

Slide 93

Slide 93 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS silent classes processed looks much like the Mixin solution, but no styles will be duplicated

Slide 94

Slide 94 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS silent classes processed looks much like the Mixin solution, but no styles will be duplicated as styles are reused, they will be properly extended in the CSS

Slide 95

Slide 95 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS silent classes processed looks much like the Mixin solution, but no styles will be duplicated as styles are reused, they will be properly extended in the CSS no unsightly presentational classes created

Slide 96

Slide 96 text

.post_summary { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_summary h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .post_summary a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS silent classes processed looks much like the Mixin solution, but no styles will be duplicated as styles are reused, they will be properly extended in the CSS no unsightly presentational classes created elegant extendible solution from the CSS, not in the markup!

Slide 97

Slide 97 text

.post_summary { @extend %default_block; h1 { @extend %post_header; } a { @extend %button; @extend %primary_button; } } .main_article { @extend %default_block; h3 { @extend %post_header; } } button { @extend %button; @extend %primary_button; } OO’S’CSS the robot will make us all happy!

Slide 98

Slide 98 text

.post_summary { @extend %default_block; h1 { @extend %post_header; } a { @extend %button; @extend %primary_button; } } .main_article { @extend %default_block; h3 { @extend %post_header; } } button { @extend %button; @extend %primary_button; } OO’S’CSS the robot will make us all happy! THIS IS GREAT!

Slide 99

Slide 99 text

.post_summary { @extend %default_block; h1 { @extend %post_header; } a { @extend %button; @extend %primary_button; } } .main_article { @extend %default_block; h3 { @extend %post_header; } } button { @extend %button; @extend %primary_button; } OO’S’CSS the robot will make us all happy! THIS IS GREAT! REALLY REUSING SOME CODE!

Slide 100

Slide 100 text

.post_summary { @extend %default_block; h1 { @extend %post_header; } a { @extend %button; @extend %primary_button; } } .main_article { @extend %default_block; h3 { @extend %post_header; } } button { @extend %button; @extend %primary_button; } OO’S’CSS the robot will make us all happy! THIS IS GREAT! REALLY REUSING SOME CODE! OH MAN! THIS IS SOOOO DRY!

Slide 101

Slide 101 text

.post_summary, .main_article { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary, .main_article { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_summary h1, .main_article h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a, .main_article a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .post_summary a, .main_article a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover, .main_article a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active, .main_article a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS silent classes processed

Slide 102

Slide 102 text

.post_summary, .main_article { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary, .main_article { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_summary h1, .main_article h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a, .main_article a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .post_summary a, .main_article a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover, .main_article a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active, .main_article a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS silent classes processed REUSE w/o DUPLICATION!

Slide 103

Slide 103 text

.post_summary, .main_article { width: 40em; box-sizing: border-box; padding: 2em; margin: 1em 0.625em 1em 0; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); } .post_summary, .main_article { border: 2px solid rgba(0, 0, 0, 0.3); border-radius: 0.9375em; } .post_summary h1, .main_article h1 { font-family: "Arial Narrow"; font-weight: lighter; } .post_summary a, .main_article a { font-size: 1.5em; display: inline-block; font-weight: bold; color: white; text-shadow: 0 0 3px rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 5px; border: 1px solid #4c6812; text-decoration: none; } .post_summary a, .main_article a { background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%); } .post_summary a:hover, .main_article a:hover { background: -webkit-linear- gradient(top, #e0f3b9 0%, #bad57d 100%); } .post_summary a:active, .main_article a:active { background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%); } OO’S’CSS silent classes processed REUSE w/o DUPLICATION! Freebird

Slide 104

Slide 104 text

BEST PRACTICES the DOs and DON’Ts of silent placeholders

Slide 105

Slide 105 text

BEST PRACTICES DON’T: Intermingle selector types .default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%)

Slide 106

Slide 106 text

BEST PRACTICES DON’T: Intermingle selector types .default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) Presentational

Slide 107

Slide 107 text

BEST PRACTICES DON’T: Intermingle selector types .default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) Presentational Functional

Slide 108

Slide 108 text

BEST PRACTICES DON’T: Intermingle selector types .default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) Presentational Functional

Slide 109

Slide 109 text

BEST PRACTICES DON’T: Intermingle selector types .default_block width: 480 / 12 * 1em box-sizing: border-box padding: 2em margin: 1em 10 / 16 * 1em 1em 0 box-shadow: 0 0 30px transparentize(black, 0.5) @extend %default_border %default_border border: 2px solid transparentize(black, 0.7) border-radius: 15 / 16 * 1em .post_header font-family: "Arial Narrow" font-weight: lighter %button font-size: 1.5em display: inline-block font-weight: bold color: white text-shadow: 0 0 3px transparentize(black, 0.5) padding: 10px border-radius: 5px border: 1px solid darken(#cdeb8e, 50%) text-decoration: none %primary_button background: -webkit-linear- gradient(top, #cdeb8e 0%, #a5c956 100%) &:hover background: -webkit-linear- gradient(top, lighten(#cdeb8e, 10%) 0%, lighten(#a5c956, 10%) 100%) &:active background: -webkit-linear- gradient(top, #a5c956 0%, #cdeb8e 100%) Presentational Functional * Reduces read-ability * Reduces find-ability * Reduces import-ability

Slide 110

Slide 110 text

BEST PRACTICES DO: Keep a clean separation of concerns buttons/ _mixins.scss _extends.scss _buttons.scss // Custom button extends and mixins // ----------------------------------- @import "buttons/mixins" @import "buttons/extends" // buttons // ----------------------------------- button, a.button, input[type=button], input[type=submit] +flat-default font-style: italic margin-right: 1em &:hover text-decoration: none &[disabled], &.disabled @extend %disabled-button &:hover @extend %disabled-button @media #{$mobile} margin-right: 0

Slide 111

Slide 111 text

BEST PRACTICES DO: Keep a clean separation of concerns buttons/ _mixins.scss _extends.scss _buttons.scss // Custom button extends and mixins // ----------------------------------- @import "buttons/mixins" @import "buttons/extends" // buttons // ----------------------------------- button, a.button, input[type=button], input[type=submit] +flat-default font-style: italic margin-right: 1em &:hover text-decoration: none &[disabled], &.disabled @extend %disabled-button &:hover @extend %disabled-button @media #{$mobile} margin-right: 0 Presentational

Slide 112

Slide 112 text

BEST PRACTICES DO: Keep a clean separation of concerns buttons/ _mixins.scss _extends.scss _buttons.scss // Custom button extends and mixins // ----------------------------------- @import "buttons/mixins" @import "buttons/extends" // buttons // ----------------------------------- button, a.button, input[type=button], input[type=submit] +flat-default font-style: italic margin-right: 1em &:hover text-decoration: none &[disabled], &.disabled @extend %disabled-button &:hover @extend %disabled-button @media #{$mobile} margin-right: 0 Presentational Functional

Slide 113

Slide 113 text

BEST PRACTICES DO: Keep a clean separation of concerns buttons/ _mixins.scss _extends.scss _buttons.scss // Custom button extends and mixins // ----------------------------------- @import "buttons/mixins" @import "buttons/extends" // buttons // ----------------------------------- button, a.button, input[type=button], input[type=submit] +flat-default font-style: italic margin-right: 1em &:hover text-decoration: none &[disabled], &.disabled @extend %disabled-button &:hover @extend %disabled-button @media #{$mobile} margin-right: 0 Presentational Functional

Slide 114

Slide 114 text

BEST PRACTICES DON’T: Extend Native HTML Selectors .banner-header ! ... h1, h2, h3 @extend h1 .episode-header !... h1 color: $white margin: 0 line-height: 1em float: left

Slide 115

Slide 115 text

BEST PRACTICES DON’T: Extend Native HTML Selectors .banner-header ! ... h1, h2, h3 @extend h1 .episode-header !... h1 color: $white margin: 0 line-height: 1em float: left @extend works by inserting the extending selector (e.g. h1) anywhere in the stylesheet that the extended selector (.e.g h1) appears. Later on, when you want to edit the style of the `h1`, Sass will loop through all the possible `h1` combinations.

Slide 116

Slide 116 text

BEST PRACTICES DON’T: Extend Native HTML Selectors .episode-header h1, .season-header h1, .episode-header .banner- header h1, .banner-header .episode-header h1, .season- header .banner-header h1, .banner-header .season-header h1, .episode-header .banner-header h2, .banner-header .episode- header h2, .season-header .banner-header h2, .banner- header .season-header h2, .episode-header .banner-header h3, .banner-header .episode-header h3, .season-header .banner- header h3, .banner-header .season-header h3, .episode- header .banner-header .cart-total-container .cart-total span, .banner-header .cart-total-container .cart-total .episode- header span, .season-header .banner-header .cart-total- container .cart-total span, .banner-header .cart-total- container .cart-total .season-header span, .episode-header .cart- total-container .cart-total .banner-header span, .cart-total- container .cart-total .banner-header .episode-header span, .season-header .cart-total-container .cart-total .banner- header span, .cart-total-container .cart-total .banner- header .season-header span, .episode-header .banner-header .order- total-container .cart-total span, .banner-header .order-total- container .cart-total .episode-header span, .season- header .banner-header .order-total-container .cart-total span, .banner-header .order-total-container .cart-total .season- header span, .episode-header .order-total-container .cart- total .banner-header span, .order-total-container .cart- total .banner-header .episode-header span, .season-header .order- total-container .cart-total .banner-header span, .order-total- container .cart-total .banner-header .season-header span, .episode-header .purchase-item-container .price, .purchase- item-container .episode-header .price, .season-header .purchase- item-container .price, .purchase-item-container .season- header .price, .episode-header .call-to-action .tel, .call-to- action .episode-header .tel, .season-header .call-to- action .tel, .call-to-action .season-header .tel { color: white; margin: 0; line-height: 1em; float: left; } .banner-header ! ... h1, h2, h3 @extend h1 .episode-header !... h1 color: $white margin: 0 line-height: 1em float: left

Slide 117

Slide 117 text

BEST PRACTICES DON’T: Extend Native HTML Selectors .episode-header h1, .season-header h1, .episode-header .banner- header h1, .banner-header .episode-header h1, .season- header .banner-header h1, .banner-header .season-header h1, .episode-header .banner-header h2, .banner-header .episode- header h2, .season-header .banner-header h2, .banner- header .season-header h2, .episode-header .banner-header h3, .banner-header .episode-header h3, .season-header .banner- header h3, .banner-header .season-header h3, .episode- header .banner-header .cart-total-container .cart-total span, .banner-header .cart-total-container .cart-total .episode- header span, .season-header .banner-header .cart-total- container .cart-total span, .banner-header .cart-total- container .cart-total .season-header span, .episode-header .cart- total-container .cart-total .banner-header span, .cart-total- container .cart-total .banner-header .episode-header span, .season-header .cart-total-container .cart-total .banner- header span, .cart-total-container .cart-total .banner- header .season-header span, .episode-header .banner-header .order- total-container .cart-total span, .banner-header .order-total- container .cart-total .episode-header span, .season- header .banner-header .order-total-container .cart-total span, .banner-header .order-total-container .cart-total .season- header span, .episode-header .order-total-container .cart- total .banner-header span, .order-total-container .cart- total .banner-header .episode-header span, .season-header .order- total-container .cart-total .banner-header span, .order-total- container .cart-total .banner-header .season-header span, .episode-header .purchase-item-container .price, .purchase- item-container .episode-header .price, .season-header .purchase- item-container .price, .purchase-item-container .season- header .price, .episode-header .call-to-action .tel, .call-to- action .episode-header .tel, .season-header .call-to- action .tel, .call-to-action .season-header .tel { color: white; margin: 0; line-height: 1em; float: left; } .banner-header ! ... h1, h2, h3 @extend h1 .episode-header !... h1 color: $white margin: 0 line-height: 1em float: left

Slide 118

Slide 118 text

BEST PRACTICES DO: Extend Silent Placeholders .banner-header ! ... h1, h2, h3 @extend %headings_1 @extend %upcase_heading .episode-header ! ... h1 color: $white margin: 0 line-height: 1em float: left Replacing the native selector with placeholder selectors, we will eliminate the unnecessary Sass loop

Slide 119

Slide 119 text

BEST PRACTICES DO: Extend Silent Placeholders .episode-header h1, .season-header h1, .episode-header .purchase-item- container .price, .purchase-item- container .episode- header .price, .season- header .purchase-item- container .price, .purchase-item- container .season- header .price, .episode- header .call-to-action .tel, .call- to-action .episode- header .tel, .season-header .call- to-action .tel, .call-to- action .season-header .tel { color: white; margin: 0; line-height: 1em; float: left; } .banner-header ! ... h1, h2, h3 @extend %headings_1 @extend %upcase_heading .episode-header ! ... h1 color: $white margin: 0 line-height: 1em float: left

Slide 120

Slide 120 text

BEST PRACTICES DO: Extend Silent Placeholders .episode-header h1, .season-header h1, .episode-header .purchase-item- container .price, .purchase-item- container .episode- header .price, .season- header .purchase-item- container .price, .purchase-item- container .season- header .price, .episode- header .call-to-action .tel, .call- to-action .episode- header .tel, .season-header .call- to-action .tel, .call-to- action .season-header .tel { color: white; margin: 0; line-height: 1em; float: left; } .banner-header ! ... h1, h2, h3 @extend %headings_1 @extend %upcase_heading .episode-header ! ... h1 color: $white margin: 0 line-height: 1em float: left

Slide 121

Slide 121 text

ADVANCED this is almost meta programming man!

Slide 122

Slide 122 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! }

Slide 123

Slide 123 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable.

Slide 124

Slide 124 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable. Returned value used as variable in mixin.

Slide 125

Slide 125 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable. Returned value used as variable in mixin. Primary placeholder selector

Slide 126

Slide 126 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable. Returned value used as variable in mixin. Primary placeholder selector Extended placeholder selector

Slide 127

Slide 127 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable. Returned value used as variable in mixin. Primary placeholder selector Extended placeholder selector Include the mixin

Slide 128

Slide 128 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable. Returned value used as variable in mixin. Primary placeholder selector Extended placeholder selector Include the mixin Create semantic selectors that extend on variations created from the mixin

Slide 129

Slide 129 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable. Returned value used as variable in mixin. Primary placeholder selector Extended placeholder selector Include the mixin Create semantic selectors that extend on variations created from the mixin PROFIT!

Slide 130

Slide 130 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable. Returned value used as variable in mixin. Primary placeholder selector Extended placeholder selector Include the mixin Create semantic selectors that extend on variations created from the mixin PROFIT! I’m Lu Nelson, I inspired this code!

Slide 131

Slide 131 text

ADVANCED PLACEHOLDERS functions, mixins and placeholders ... oh my! @function gcd($n, $d) $num: if($n < $d, $d, $n) $denom: if($n < $d, $n, $d) $rem: $num $last_rem: $num @while $rem != 0 $last_rem: $rem $rem: $denom % $num $denom: $num $num: $rem @return $last_rem =grid-setup($ns: grid, $grid_columns: 24) $ns: if($ns == "", $ns, "#{$ns}-") @for $d from 1 through $grid_columns @for $n from 1 through $d $gcd: gcd($n, $d) $x: $n / $gcd %#{$ns}#{$n}of#{$d} @if $x < $n @extend %#{$ns}#{$x}of#{$d / $gcd} @else width: $n / $d * 100% +grid-setup .foo @extend %grid-5of5 .bar @extend %grid-1of8 .baz @extend %grid-2of9 .crypto @extend %grid-2of9 ! ! ! ! .foo { ! ! ! ! width: 100%; ! ! ! ! } ! ! ! ! ! ! ! ! .bar { ! ! ! ! width: 12.5%; ! ! ! ! } ! ! ! ! ! ! ! ! .baz, .crypto { ! ! ! ! width: 22.22222%; ! ! ! ! } Function to loop through column variable. Returned value used as variable in mixin. Primary placeholder selector Extended placeholder selector Include the mixin Create semantic selectors that extend on variations created from the mixin PROFIT! I’m Lu Nelson, I inspired this code! https:// github.com/ lunelson

Slide 132

Slide 132 text

SUMMARY what have we learned?

Slide 133

Slide 133 text

SUMMARY what have we learned? OOCSS UI frameworks can add some serious CSS bloat

Slide 134

Slide 134 text

SUMMARY what have we learned? OOCSS UI frameworks can add some serious CSS bloat Managing presentational CSS extending in the DOM has it’s issues

Slide 135

Slide 135 text

SUMMARY what have we learned? OOCSS UI frameworks can add some serious CSS bloat Managing presentational CSS extending in the DOM has it’s issues Extending classes with 4914 lines of presentational CSS makes my brain hurt A LOT!

Slide 136

Slide 136 text

SUMMARY what have we learned? OOCSS UI frameworks can add some serious CSS bloat Managing presentational CSS extending in the DOM has it’s issues Extending classes with 4914 lines of presentational CSS makes my brain hurt A LOT! OO’S’CSS using a CSS processor will change your life!

Slide 137

Slide 137 text

SUMMARY what have we learned? OOCSS UI frameworks can add some serious CSS bloat Managing presentational CSS extending in the DOM has it’s issues Extending classes with 4914 lines of presentational CSS makes my brain hurt A LOT! OO’S’CSS using a CSS processor will change your life! @mixin was a great start, but we can do it better.

Slide 138

Slide 138 text

SUMMARY what have we learned? OOCSS UI frameworks can add some serious CSS bloat Managing presentational CSS extending in the DOM has it’s issues Extending classes with 4914 lines of presentational CSS makes my brain hurt A LOT! OO’S’CSS using a CSS processor will change your life! @mixin was a great start, but we can do it better. @extend is awesome, but we can do it better.

Slide 139

Slide 139 text

SUMMARY what have we learned? OOCSS UI frameworks can add some serious CSS bloat Managing presentational CSS extending in the DOM has it’s issues Extending classes with 4914 lines of presentational CSS makes my brain hurt A LOT! OO’S’CSS using a CSS processor will change your life! @mixin was a great start, but we can do it better. @extend is awesome, but we can do it better. Take everything you know AND SET IT ON FIRE!

Slide 140

Slide 140 text

SUMMARY what have we learned? OOCSS UI frameworks can add some serious CSS bloat Managing presentational CSS extending in the DOM has it’s issues Extending classes with 4914 lines of presentational CSS makes my brain hurt A LOT! OO’S’CSS using a CSS processor will change your life! @mixin was a great start, but we can do it better. @extend is awesome, but we can do it better. Take everything you know AND SET IT ON FIRE! %foo

Slide 141

Slide 141 text

QUESTIONS? you, in the front ...