Example #1
0
 /**
  * Parse this node.
  * If a CSS import returns the import rule.
  * Else returns the rendered tree for the file.
  * @param SassContext the context in which this node is parsed
  * @return array the parsed node
  */
 public function parse($context)
 {
     if (preg_match(self::MATCH_CSS, $this->uri)) {
         return "@import {$this->uri}";
     } else {
         $tree = SassFile::getTree(SassFile::getFile($this->uri, $this->options), $this->options);
         if (empty($tree)) {
             throw new SassImportNodeException("Unable to create document tree for {$this->uri}");
         } else {
             return $tree->parse($context)->children;
         }
     }
 }
Example #2
0
 /**
  * Parse this node.
  * If the node is a CSS import return the CSS import rule.
  * Else returns the rendered tree for the file.
  * 
  * @param
  *        	SassContext the context in which this node is parsed
  * @return array the parsed node
  */
 public function parse($context)
 {
     $imported = array();
     foreach ($this->files as $file) {
         if (preg_match(self::MATCH_CSS, $file)) {
             return "@import {$file}";
         } else {
             $file = trim($file, '\'"');
             $tree = SassFile::getTree(SassFile::getFile($file, $this->parser), $this->parser);
             if (empty($tree)) {
                 throw new SassImportNodeException('Unable to create document tree for {file}', array('{file}' => $file), $this);
             } else {
                 $imported = array_merge($imported, $tree->parse($context)->children);
             }
         }
     }
     return $imported;
 }