| 1 |
|
| 2 |
@function hello($x) { |
| 3 |
@return $x + 4; |
| 4 |
} |
| 5 |
|
| 6 |
@function add($a, $b) { |
| 7 |
@return $a + $b; |
| 8 |
} |
| 9 |
|
| 10 |
div { |
| 11 |
color: hello(10px); |
| 12 |
sum: add(11, 12); |
| 13 |
} |
| 14 |
|
| 15 |
// make sure values are being reduced before being passed up to previous scope |
| 16 |
|
| 17 |
@function one($a, $b) { |
| 18 |
@return $a $b; |
| 19 |
} |
| 20 |
|
| 21 |
@function two($a, $b) { |
| 22 |
@return $a#{$a} $b; |
| 23 |
} |
| 24 |
|
| 25 |
@function three($a, $b: default) { |
| 26 |
@return "hello #{$a} and #{$b}" |
| 27 |
} |
| 28 |
|
| 29 |
@function all($a...) { |
| 30 |
@return "hello #{$a}" |
| 31 |
} |
| 32 |
|
| 33 |
div { |
| 34 |
hello: one(10, 55); |
| 35 |
hello: two(10, 55); |
| 36 |
hello: three(10, 55); |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
@function hello_world() { |
| 41 |
@return 1000; |
| 42 |
} |
| 43 |
|
| 44 |
del { |
| 45 |
color: hello-world(); |
| 46 |
} |
| 47 |
|
| 48 |
div { |
| 49 |
$args: foo bar; |
| 50 |
hello: three($args...); |
| 51 |
hello: three(bar...); |
| 52 |
hello: all(Alice, Bob, Tom); |
| 53 |
} |
| 54 |
|
| 55 |
@function stringConcatCompassStyle($start,$last) |
| 56 |
{ |
| 57 |
// Compass still uses it like this |
| 58 |
@return #{$start}-#{$last}; |
| 59 |
} |
| 60 |
|
| 61 |
.foo |
| 62 |
{ |
| 63 |
test2: stringConcatCompassStyle(-moz,art); |
| 64 |
} |
| 65 |
|
| 66 |
@mixin content_test { |
| 67 |
span { |
| 68 |
$color: green; |
| 69 |
@content; |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
@function func_test($c) { |
| 74 |
@return $c + 1; |
| 75 |
} |
| 76 |
|
| 77 |
div { |
| 78 |
@include content_test { |
| 79 |
height: func_test(2px); |
| 80 |
} |
| 81 |
} |
| 82 |
|