Created
September 12, 2013 18:49
-
-
Save micahgodbolt/6542163 to your computer and use it in GitHub Desktop.
SassBites#7 Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$foo: 1; | |
$bar: 6; | |
@while $foo < $bar { | |
h#{$foo} { // do something | |
font-size: ($bar - $foo)+em; | |
} | |
$foo: $foo + 1; // advance a counter | |
} | |
----------------------------------------------- | |
@mixin color-family($color, $steps, $amount) { | |
$var: 0; | |
@while $var < $steps { | |
.class-#{$var} { | |
color: darken($color, ($var * $amount)); | |
} | |
$var: $var + 1; | |
} | |
} | |
@include color-family(blue, 5, 10%); | |
-------------------------------------- | |
@import "compass"; | |
@function sort($list) { | |
$sortedlist: (); | |
@while length($list) > 0 { | |
$value: nth($list,1); | |
@each $item in $list { | |
@if $item < $value { | |
$value: $item; | |
} | |
} | |
$sortedlist: append($sortedlist, $value, 'space'); | |
$list: reject($list, $value); | |
} | |
@return $sortedlist; | |
} | |
$vars: 12 10 13 9; | |
div { | |
original: $vars; | |
sorted: sort($vars); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment