protected compileBlock ( Leafo\ScssPhp\Block $block ) | ||
$block | Leafo\ScssPhp\Block |
protected function compileBlock(Block $block)
{
$env = $this->pushEnv($block);
$env->selectors = $this->evalSelectors($block->selectors);
$out = $this->makeOutputBlock(null);
if (isset($this->lineNumberStyle) && count($env->selectors) && count($block->children)) {
$annotation = $this->makeOutputBlock(Type::T_COMMENT);
$annotation->depth = 0;
$file = $this->sourceNames[$block->sourceIndex];
$line = $block->sourceLine;
switch ($this->lineNumberStyle) {
case static::LINE_COMMENTS:
$annotation->lines[] = '/* line ' . $line . ($file ? ', ' . $file : '') . ' */';
break;
case static::DEBUG_INFO:
$annotation->lines[] = '@media -sass-debug-info{' . ($file ? 'filename{font-family:"' . $file . '"}' : '') . 'line{font-family:' . $line . '}}';
break;
}
$this->scope->children[] = $annotation;
}
$this->scope->children[] = $out;
if (count($block->children)) {
$out->selectors = $this->multiplySelectors($env);
$this->compileChildrenNoReturn($block->children, $out);
}
$this->formatter->stripSemicolon($out->lines);
$this->popEnv();
}