Leafo\ScssPhp\Compiler::compileAtRoot PHP Method

compileAtRoot() protected method

Compile at-root
protected compileAtRoot ( Leafo\ScssPhp\Block $block )
$block Leafo\ScssPhp\Block
    protected function compileAtRoot(Block $block)
    {
        $env = $this->pushEnv($block);
        $envs = $this->compactEnv($env);
        $without = isset($block->with) ? $this->compileWith($block->with) : static::WITH_RULE;
        // wrap inline selector
        if ($block->selector) {
            $wrapped = new Block();
            $wrapped->sourceIndex = $block->sourceIndex;
            $wrapped->sourceLine = $block->sourceLine;
            $wrapped->sourceColumn = $block->sourceColumn;
            $wrapped->selectors = $block->selector;
            $wrapped->comments = [];
            $wrapped->parent = $block;
            $wrapped->children = $block->children;
            $block->children = [[Type::T_BLOCK, $wrapped]];
        }
        $this->env = $this->filterWithout($envs, $without);
        $newBlock = $this->spliceTree($envs, $block, $without);
        $saveScope = $this->scope;
        $this->scope = $this->rootBlock;
        $this->compileChild($newBlock, $this->scope);
        $this->scope = $saveScope;
        $this->env = $this->extractEnv($envs);
        $this->popEnv();
    }
Compiler