Ejemplo n.º 1
0
 /**
  * @see ILess_Node::generateCSS
  */
 public function generateCSS(ILess_Environment $env, ILess_Output $output)
 {
     if ($env->strictUnits && !$this->unit->isSingular()) {
         throw new ILess_Exception_Compiler(sprintf('Multiple units in dimension. Correct the units or use the unit function. Bad unit: %s', $this->unit->toString()));
     }
     $value = $this->value;
     // Zero values doesn't need a unit
     if ($env->compress) {
         if ($value == 0 && $this->unit->isLength()) {
             $output->add($value);
             // no need to continue
             return;
         } elseif ($value > 0 && $value < 1 && $value[0] === '0') {
             $value = substr($value, 1);
         }
     }
     $output->add($value);
     // pass to unit
     $this->unit->generateCSS($env, $output);
 }
Ejemplo n.º 2
0
 /**
  * Compares two units
  *
  * @param ILess_Node_DimensionUnit $other
  * @return integer| 0 or -1
  */
 public function compare(ILess_Node_DimensionUnit $other)
 {
     return $this->is($other->toString()) ? 0 : -1;
 }