sassive aggressive: level up your css with sass

33
Sassive Aggressive // Level Up Your CSS with Sass @import the-awesome

Upload: adam-darowski

Post on 06-May-2015

1.744 views

Category:

Design


1 download

DESCRIPTION

As the line between designer and developer continues to blur, we need more from CSS than it can offer. Sass is an extension of CSS that adds basic features CSS is sorely missing (like variables and nesting). But Sass kicks things to a new level with mixins (flexible, re-usable blocks of CSS) and advanced selector inheritance. Simply put, Sass makes CSS authoring fun again.

TRANSCRIPT

Page 1: Sassive Aggressive: Level Up Your CSS with Sass

Sassive Aggressive// Level Up Your CSS with Sass@import the-awesome

Page 2: Sassive Aggressive: Level Up Your CSS with Sass

What is Sass?

Page 3: Sassive Aggressive: Level Up Your CSS with Sass

What is Sass?Syntacticallyawesomestylesheets

Page 4: Sassive Aggressive: Level Up Your CSS with Sass

We all use CSS sucks

Page 5: Sassive Aggressive: Level Up Your CSS with Sass

We all use CSS sucksbut

Page 6: Sassive Aggressive: Level Up Your CSS with Sass

We all use CSS sucksbut

Especially if you’ve used Sass.

Page 7: Sassive Aggressive: Level Up Your CSS with Sass

Sass takes everything that’s missing from CSS

and puts it into CSS.

Page 8: Sassive Aggressive: Level Up Your CSS with Sass

Sass takes everything that’s missing from CSS

and puts it into CSS.

Page 9: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: 0;}

Things like…

Page 10: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: $logo-color; font: 16px/1.6 Georgia; margin: 0;}

Variables

Page 11: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: 0; a { display: block; width: 100px; height: 50px; }}

Nesting

Page 12: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: 0; &.new { color: red; }}

The Ampersand

Page 13: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: 0;}h2 { @extend h1; font-size: 14px;}

Selector Inheritance

Page 14: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: $default_margin * 2;}

Calculations

Page 15: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: lighten(#000, 25%); font: 16px/1.6 Georgia; margin: 0;}

Color Manipulation

Page 16: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: 0; @include border-radius(4px);}

Mixins

Page 17: Sassive Aggressive: Level Up Your CSS with Sass

And so, so much more.

Page 18: Sassive Aggressive: Level Up Your CSS with Sass

Sass does not replace CSS.

Page 19: Sassive Aggressive: Level Up Your CSS with Sass

Sass does not replace CSS.Sass makes CSS.

Page 20: Sassive Aggressive: Level Up Your CSS with Sass

Sass does not replace CSS.Sass makes CSS.

better.

Page 21: Sassive Aggressive: Level Up Your CSS with Sass

Three more thingsbefore we play…

Page 22: Sassive Aggressive: Level Up Your CSS with Sass

What’s ?http://compass-style.org

• a framework that uses Sass• an open source project• a collection of reusable design patterns that

makes using the latest CSS features super easy

Compass is not Sass, but they are oen grouped together.

1

Page 23: Sassive Aggressive: Level Up Your CSS with Sass

Two SyntaxesSCSS

2

Page 24: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: 0; a { display: block; width: 100px; height: 50px; }}

Two SyntaxesSCSS

2

Page 25: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: 0; a { display: block; width: 100px; height: 50px; }}

Two SyntaxesSCSS booooooo

2

Page 26: Sassive Aggressive: Level Up Your CSS with Sass

h1 { color: #000; font: 16px/1.6 Georgia; margin: 0; a { display: block; width: 100px; height: 50px; }}

Two SyntaxesSCSS booooooo

DISCLAIMER: Adam’s opinion of the

SCSS syntax do not represent Joel’s

opinion of the SCSS syntax.

2

Page 27: Sassive Aggressive: Level Up Your CSS with Sass

h1 color: #000 font: 16px/1.6 Georgia margin: 0 a display: block width: 100px height: 50px

Two SyntaxesSass

2

Page 28: Sassive Aggressive: Level Up Your CSS with Sass

h1 color: #000 font: 16px/1.6 Georgia margin: 0 a display: block width: 100px height: 50px

Two SyntaxesSass yaaaaaay

2

Page 29: Sassive Aggressive: Level Up Your CSS with Sass

Don’t be afraid.

The Command Line3

Page 30: Sassive Aggressive: Level Up Your CSS with Sass

Let’s look at some code!

Page 31: Sassive Aggressive: Level Up Your CSS with Sass

NOTE: At this point, we switched to a

live code demonstration (with Sass/

SCSS on the left and auto-updating

compiled CSS on the right).

Page 32: Sassive Aggressive: Level Up Your CSS with Sass

See the code:https://github.com/jayroh/sass-harvard

Note that the code samples are stored within the same !le, but on different branches. Here are the direct links to each branch:

Ampersand (Sass/SCSS)Calculations (Sass/SCSS)

Colors (Sass/SCSS)Compass (Sass/SCSS)

Extend (Sass/SCSS)Loops (Sass/SCSS)

Mixins (Sass/SCSS)Nesting (Sass/SCSS)Partials (Sass/SCSS)Responsive (Sass/SCSS)Sprites (Sass/SCSS)Variables (Sass/SCSS)