Example #1
0
 /**
  * @see ILess_Node
  */
 public function compile(ILess_Environment $env, $arguments = null, $important = null)
 {
     if ($this->skip) {
         return array();
     }
     if ($this->getOption('inline')) {
         // FIXME: this section is marked as "todo" in less.js project
         // see: lib/less/tree/import.js
         // original comment: todo needs to reference css file not import
         // $this->root is string here!
         $contents = new ILess_Node_Anonymous($this->root, 0, new ILess_FileInfo(array('filename' => $this->importedFilename)), true);
         return $this->features ? new ILess_Node_Media(array($contents), $this->features->value) : array($contents);
     } elseif ($this->css) {
         $features = $this->features ? $this->features->compile($env) : null;
         $import = new ILess_Node_Import($this->compilePath($env), $features, $this->options, $this->index);
         if (!$import->css && $import->hasError()) {
             throw $import->getError();
         }
         return $import;
     } else {
         $ruleset = new ILess_Node_Ruleset(array(), $this->root ? $this->root->rules : array());
         $ruleset->compileImports($env);
         return $this->features ? new ILess_Node_Media($ruleset->rules, $this->features->value) : $ruleset->rules;
     }
 }