diff --git a/lib/Less/Environment.php b/lib/Less/Environment.php index 35b8ff4c..1ad5b127 100644 --- a/lib/Less/Environment.php +++ b/lib/Less/Environment.php @@ -32,7 +32,6 @@ class Less_Environment { public static $lastRule = false; - public static $_outputMap; public static $_noSpaceCombinators; public static $mixin_stack = 0; @@ -55,40 +54,6 @@ public function Init() { ' ' => true, '|' => true ]; - - if ( Less_Parser::$options['compress'] ) { - - self::$_outputMap = [ - ',' => ',', - ': ' => ':', - '' => '', - ' ' => ' ', - ':' => ' :', - '+' => '+', - '~' => '~', - '>' => '>', - '|' => '|', - '^' => '^', - '^^' => '^^' - ]; - - } else { - - self::$_outputMap = [ - ',' => ', ', - ': ' => ': ', - '' => '', - ' ' => ' ', - ':' => ' :', - '+' => ' + ', - '~' => ' ~ ', - '>' => ' > ', - '|' => '|', - '^' => ' ^ ', - '^^' => ' ^^ ' - ]; - - } } public function copyEvalEnv( $frames = [] ) { diff --git a/lib/Less/Functions.php b/lib/Less/Functions.php index 975ba2f1..e6027f63 100644 --- a/lib/Less/Functions.php +++ b/lib/Less/Functions.php @@ -775,7 +775,7 @@ private function _minmax( $isMin, $args ) { foreach ( $order as $a ) { $args[] = $a->toCSS(); } - return new Less_Tree_Anonymous( ( $isMin ? 'min(' : 'max(' ) . implode( Less_Environment::$_outputMap[','], $args ) . ')' ); + return new Less_Tree_Anonymous( ( $isMin ? 'min(' : 'max(' ) . implode( ( Less_Parser::$options['compress'] ? ',' : ', ' ), $args ) . ')' ); } public function min( ...$args ) { diff --git a/lib/Less/Tree/NameValue.php b/lib/Less/Tree/NameValue.php index 32c1b092..f35d819a 100644 --- a/lib/Less/Tree/NameValue.php +++ b/lib/Less/Tree/NameValue.php @@ -28,7 +28,7 @@ public function __construct( $name, $value = null, $index = null, $currentFileIn public function genCSS( $output ) { $output->add( $this->name - . Less_Environment::$_outputMap[': '] + . ( Less_Parser::$options['compress'] ? ':' : ': ' ) . $this->value . $this->important . ( ( ( Less_Environment::$lastRule && Less_Parser::$options['compress'] ) ) ? "" : ";" ), diff --git a/lib/Less/Tree/Rule.php b/lib/Less/Tree/Rule.php index 3a001bae..8d46a291 100644 --- a/lib/Less/Tree/Rule.php +++ b/lib/Less/Tree/Rule.php @@ -42,10 +42,10 @@ public function accept( $visitor ) { } /** - * @see Less_Tree::genCSS + * @see less-2.5.3.js#Rule.prototype.genCSS */ public function genCSS( $output ) { - $output->add( $this->name . Less_Environment::$_outputMap[': '], $this->currentFileInfo, $this->index ); + $output->add( $this->name . ( Less_Parser::$options['compress'] ? ':' : ': ' ), $this->currentFileInfo, $this->index ); try { $this->value->genCSS( $output ); diff --git a/lib/Less/Tree/Value.php b/lib/Less/Tree/Value.php index ccd73396..68336c73 100644 --- a/lib/Less/Tree/Value.php +++ b/lib/Less/Tree/Value.php @@ -31,14 +31,14 @@ public function compile( $env ) { } /** - * @see Less_Tree::genCSS + * @see less-2.5.3.js#Value.prototype.genCSS */ public function genCSS( $output ) { $len = count( $this->value ); for ( $i = 0; $i < $len; $i++ ) { $this->value[$i]->genCSS( $output ); if ( $i + 1 < $len ) { - $output->add( Less_Environment::$_outputMap[','] ); + $output->add( Less_Parser::$options['compress'] ? ',' : ', ' ); } } }