13 - "@for @each @while @if @else"
15 - "$map: (a: b, c: d)"
58 font-family: sans-serif;
65 @include heading-font;
72 @mixin font-size($n) {
73 font-size: $n * 1.2em;
79 @include font-size(2);
83 #### with default values
86 @mixin pad($n: 10px) {
97 #### with a default variable
100 // Set a default value
101 $default-padding: 10px;
105 @mixin pad($n: $default-padding) {
133 @import './other_sass_file`;
136 The `.scss` or `.sass` extension is optional.
144 rgba(100, 120, 140, .5)
151 mix($a, $b, 10%) // 10% a, 90% b
163 desaturate($color, 5%)
168 adjust-hue($color, 15deg)
169 complement($color) // like adjust-hue(_, 180deg)
174 fade-in($color, .5) // aka opacify()
175 fade-out($color, .5) // aka transparentize() - halves the opacity
176 rgba($color, .5) // sets alpha to .5
179 ### Getting individual values
184 hue($color) // → 0deg..360deg
185 saturation($color) // → 0%..100%
186 lightness($color) // → 0%..100%
187 alpha($color) // → 0..1 (aka opacity())
193 red($color) // → 0..255
198 See: [hue()](http://sass-lang.com/documentation/Sass/Script/Functions.html#hue-instance_method), [red()](http://sass-lang.com/documentation/Sass/Script/Functions.html#red-instance_method)
203 // Changes by fixed amounts
204 adjust-color($color, $blue: 5)
205 adjust-color($color, $lightness: -30%) // like darken(_, 30%)
206 adjust-color($color, $alpha: -0.4) // like fade-out(_, .4)
207 adjust-color($color, $hue: 30deg) // like adjust-hue(_, 15deg)
211 // Changes via percentage
212 scale-color($color, $lightness: 50%)
216 // Changes one property completely
217 change-color($color, $hue: 180deg)
218 change-color($color, $blue: 250)
221 Supported: `$red` `$green` `$blue` `$hue` `$saturation` `$lightness` `$alpha`
238 str-length(hello world)
239 str-slice(hello, 2, 5) // "ello" - it's 1-based, not 0-based
240 str-insert("abcd", "X", 1) // "Xabcd"
247 unitless(100px) // false
265 percentage(.5) // 50%
272 variable-exists(red) // checks for $red
273 mixin-exists(red-text) // checks for @mixin red-text
274 function-exists(redify)
278 global-variable-exists(red)
282 selector-append('.menu', 'li', 'a') // .menu li a
283 selector-nest('.menu', '&:hover li') // .menu:hover li
286 selector-replace(...)
295 feature-exists(global-variable-shadowing)
300 * global-variable-shadowing
301 * extend-selector-pseudoclass
310 @for $i from 1 through 4 {
311 .item-#{$i} { left: 20px * $i; }
315 ### Each loops (simple)
318 $menu-items: home about services contact;
320 @each $item in $menu-items {
322 background: url('images/#{$item}.jpg');
327 ### Each loops (nested)
329 $backgrounds: (home, 'home.jpg'), (about, 'about.jpg');
331 @each $id, $image in $backgrounds {
333 background: url($image);
343 .item-#{$i} { width: 2em * $i; }
353 @if $position == 'left' {
365 .#{$klass} { ... } // Class
366 call($function-name) // Functions
369 font: #{$size}/#{$line-height}
370 url("#{$background}.jpg")
378 nth($list, 1) // starts with 1
381 @each $item in $list { ... }
387 $map: (key1: value1, key2: value2, key3: value3);
395 - <http://sass-lang.com/documentation/Sass/Script/Functions.html>
396 - <http://sass-lang.com/documentation/file.SASS_REFERENCE.html#sassscript>