function sassy_compass__enumerate in Sassy 7.3
Same name and namespace in other branches
- 7.2 extensions/compass/functions/enumerate.inc \sassy_compass__enumerate()
Enumerate all options within a set. Deprecated in favor of @for, @extend @example enumerate('.foo', 1, 3) => ".foo-1, .foo-2, .foo-3"
File
- sassy_compass/
functions/ enumerate.inc, line 6
Code
function sassy_compass__enumerate($prefix, $from, $to, $sep = NULL) {
$output = array();
foreach (array(
'prefix',
'from',
'to',
'sep',
) as $var) {
if (is_object(${$var})) {
${$var} = ${$var}->value;
}
}
if ($sep === NULL) {
$sep = '-';
}
for ($i = $from; $i <= $to; $i++) {
$output[] = $prefix . $sep . $i;
}
return new SassString(implode(', ', $output));
}