You are here

function sassy_compass__enumerate in Sassy 7.2

Same name and namespace in other branches
  1. 7.3 sassy_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

extensions/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));
}