sass_compass_unleashed/presentation/02_sass.slides

87 lines
1.1 KiB
Plaintext
Raw Normal View History

2012-03-13 03:06:01 +00:00
!SLIDE
# Sass
!SLIDE
# What is Sass?
## Its a preprocesor
!SLIDE
# What does it do?
* Variables `$foo`
* Mixins `@mixin`
* Functions
2012-03-13 15:49:37 +00:00
* Selector Inheritance `@extend, &`
2012-03-13 03:06:01 +00:00
* Control Directives `@if, @for, @each, @while`
2012-03-13 15:49:37 +00:00
* Its a language!
2012-03-13 03:06:01 +00:00
!SLIDE variables
# Variables
``` scss
$foo : #fffff;
$bar : (1px * 2em) / 4px;
```
!SLIDE mixins
# Functions and Mixins
``` scss
@function get-stops($colors, $stops) {
$out:();
@each $color in $colors {
$i: index($colors, $color);
$stop: 0% + nth($stops, $i);
$out: append($out, $color $stop, 'comma');
}
@return $out;
}
@mixin menu-level2-active {
$args: get-stops($menu-active-colors, $menu-active-stops);
@include background(linear-gradient($menu-active-direction, $args));
}
2012-03-13 15:49:37 +00:00
```
!SLIDE inheritance
# Inheritance
``` scss
a {
color : $link-color;
&:hover {
color : $link-hover-color;
}
}
2012-03-21 17:09:22 +00:00
```
``` css
a { color : blue; }
a:hover { color : red; }
2012-03-13 15:49:37 +00:00
```
!SLIDE extend
## Extend
``` scss
.foo {
font-size : 10px;
}
.bar {
@extend .foo;
}
```
``` css
.foo, .bar {
font-size : 10px;
}
```