function sassy_compass__nest in Sassy 7.2
Same name and namespace in other branches
- 7.3 sassy_compass/functions/selectors.inc \sassy_compass__nest()
File
- extensions/
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));
}