10

Click here to load reader

Sassy CSS (part 2) (Drupal Camp LA 2013)

Embed Size (px)

DESCRIPTION

Sass for CSS

Citation preview

Page 1: Sassy CSS (part 2) (Drupal Camp LA 2013)

Reusable snippets.Sass Mixins

@mixin my-custom-mixin { border: 1px solid $color; padding: $padding;}!

// Use your mixin over and over again

.element { @include my-custom-mixin;

}1

Page 2: Sassy CSS (part 2) (Drupal Camp LA 2013)

Useful Mixins

@mixin font-primary { font-family: “Hip Web Font”, Arial, sans-serif; font-weight: 400;}!

// Use the mixin over and over again

.element { @include font-primary;

}2

Page 3: Sassy CSS (part 2) (Drupal Camp LA 2013)

Useful Mixins + Variables

$color-primary: #FFCC00;@mixin font-primary { font-family: “Hip Web Font”, Arial, sans-serif; font-weight: 400;}!

// Use the mixin over and over again

.element { @include font-primary; color: $color-primary;

}3

Page 4: Sassy CSS (part 2) (Drupal Camp LA 2013)

Sass/SCSS #framework

‣ First Sass-based framework ‣ Provides tons of mixins ‣ Supports plugins

4

Page 5: Sassy CSS (part 2) (Drupal Camp LA 2013)

I now can stop repeating myself. I now can stop repeating myself.Compass Mixins

@include border-radius(...);@include box-shadow(...);@include text-shadow(...);@include scale(...);@include rotate(...);@include transform2d(...);@include transform3d(...);

5

Page 6: Sassy CSS (part 2) (Drupal Camp LA 2013)

Full of Sass.Compass Modules

‣ CSS3 • Effects, Fonts, Content

‣ Typography • Test, Links, Lists

‣ Utilities • Sprites, Color, Print, Tables

‣ Layout* ‣ Reset*

6

CSS

CompassSass

Page 7: Sassy CSS (part 2) (Drupal Camp LA 2013)

7

Page 8: Sassy CSS (part 2) (Drupal Camp LA 2013)

Web Browser and/or Terminal Shell requiredDebugging

// Debug compiled CSS w/Firefox + Firebug + FireSass

environment = :development

firesass = true

!

// Debug dynamic Sass using @debug function

div {

@debug $anything + 1px;

}

8

Page 9: Sassy CSS (part 2) (Drupal Camp LA 2013)

Good looks are subjective.Formatting

.standard { color: $dark; background-color: $light;}!

.spacey { color : $dark; background-color : $light;}

9

Page 10: Sassy CSS (part 2) (Drupal Camp LA 2013)

Shorthand code is harder to read.Shortcuts

@mixin pretty-text {

color: $dark;

}

!

a {

@include light;

}

!

=pretty-text {

color: $dark;

}

!

a {

+light;

}

10