Example #1
0
 public function compile($env, $args = NULL, $important = NULL)
 {
     $_arguments = array();
     $mixinFrames = array_merge($this->frames, $env->frames);
     $mixinEnv = new Less_Environment();
     $mixinEnv->addFrames($mixinFrames);
     $frame = $this->compileParams($env, $mixinEnv, $args, $_arguments);
     $ex = new Less_Tree_Expression($_arguments);
     array_unshift($frame->rules, new Less_Tree_Rule('@arguments', $ex->compile($env)));
     $rules = $important ? Less_Tree_Ruleset::makeImportant($this->selectors, $this->rules)->rules : array_slice($this->rules, 0);
     $ruleset = new Less_Tree_Ruleset(null, $rules);
     // duplicate the environment, adding new frames.
     $ruleSetEnv = new Less_Environment();
     $ruleSetEnv->addFrame($this);
     $ruleSetEnv->addFrame($frame);
     $ruleSetEnv->addFrames($mixinFrames);
     $ruleSetEnv->compress = $env->compress;
     $ruleset = $ruleset->compile($ruleSetEnv);
     $ruleset->originalRuleset = $this;
     return $ruleset;
 }