You are here

function sassy_compass__nest in Sassy 7.3

Same name and namespace in other branches
  1. 7.2 extensions/compass/functions/selectors.inc \sassy_compass__nest()

File

sassy_compass/functions/selectors.inc, line 4

Code

function sassy_compass__nest() {
  $args = func_get_args();
  $output = explode(',', array_pop($args));
  for ($i = count($args) - 1; $i >= 0; $i--) {
    $current = explode(',', $args[$i]);
    $size = count($output);
    foreach ($current as $selector) {
      for ($j = 0; $j < $size; $j++) {
        $output[] = trim($selector) . " " . trim($output[$j]);
      }
    }
    $output = array_slice($output, $size);
  }
  return new SassString(implode(', ', $output));
}