Author: Leaf Corcoran (leafot@gmail.com)
Exemplo n.º 1
0
 /**
  * Import file
  *
  * @param string $path
  * @param array  $out
  */
 protected function importFile($path, $out)
 {
     // see if tree is cached
     $realPath = realpath($path);
     if (isset($this->importCache[$realPath])) {
         $this->handleImportLoop($realPath);
         $tree = $this->importCache[$realPath];
     } else {
         $code = file_get_contents($path);
         $parser = new Parser($path, false);
         $tree = $parser->parse($code);
         $this->addParsedFile($path);
         $this->importCache[$realPath] = $tree;
     }
     $pi = pathinfo($path);
     array_unshift($this->importPaths, $pi['dirname']);
     $this->compileChildren($tree->children, $out);
     array_shift($this->importPaths);
 }
Exemplo n.º 2
0
 /**
  * Decode RAW string into contents.
  *
  * @param string $var
  * @return array mixed
  */
 protected function decode($var)
 {
     $parser = new Parser($this->filename, false);
     $tree = $parser->parse($var);
     return $tree;
 }
Exemplo n.º 3
0
 function parse($buffer)
 {
     $buffer = $this->scssFile->phpScssSupport($buffer);
     return parent::parse($buffer);
 }
 protected function importFile($path, $out)
 {
     // see if tree is cached
     $realPath = realpath($path);
     if (isset($this->importCache[$realPath])) {
         $tree = $this->importCache[$realPath];
     } else {
         $code = file_get_contents($path);
         if ($this->isLineNumbers()) {
             $code = LineCommentator::insertLineComments(file($path), $path);
         }
         $parser = new Parser($path, false);
         $tree = $parser->parse($code);
         $this->parsedFiles[] = $path;
         $this->importCache[$realPath] = $tree;
     }
     $pi = pathinfo($path);
     array_unshift($this->importPaths, $pi['dirname']);
     $this->compileChildren($tree->children, $out);
     array_shift($this->importPaths);
 }