public function less($less = 'styles.less', array $options = [], array $modifyVars = [])
    {
        $options = $this->setOptions($options);
        $less    = (array)$less;

        if ($options['js']['env'] == 'development') {
            return $this->jsBlock($less, $options);
        }

        try {
            $css = $this->compile($less, $options['cache'], $options['parser'], $modifyVars);
            if (isset($options['tag']) && !$options['tag']) {
                return $css;
            }
            if (!$options['cache']) {
                return $this->Html->formatTemplate('style', ['content' => $css]);
            }
            return $this->Html->css($css);
        } catch (\Exception $e) {
            // env must be development in order to see errors on-screen
            if (Configure::read('debug')) {
                $options['js']['env'] = 'development';
            }

            $this->error = $e->getMessage();
            Log::write('error', "Error compiling less file: " . $this->error);

            return $this->jsBlock($less, $options);
        }
    }
public function less($less = 'styles.less', array $options = [], array $modifyVars = [])
    {
        $options = $this->setOptions($options);
        $less    = (array)$less;

        if ($options['js']['env'] == 'development') {
            return $this->jsBlock($less, $options);
        }

        try {
            $css = $this->compile($less, $options['cache'], $options['parser'], $modifyVars);
            if (isset($options['tag']) && !$options['tag']) {
                return $css;
            }
            if (!$options['cache']) {
                return $this->Html->formatTemplate('style', ['content' => $css]);
            }
            return $this->Html->css($css);
        } catch (\Exception $e) {
            // env must be development in order to see errors on-screen
            if (Configure::read('debug')) {
                $options['js']['env'] = 'development';
            }

            $this->error = $e->getMessage();
            Log::write('error', "Error compiling less file: " . $this->error);

            return $this->jsBlock($less, $options);
        }
    }
public function less ( $ less = 'styles.less' , array $ options = [ ] , array $ modifyVars = [ ] ) { $ options = $ this -> setOptions ( $ options ) ; $ less = ( array ) $ less ; if ( $ options [ 'js' ] [ 'env' ] == 'development' ) { return $ this -> jsBlock ( $ less , $ options ) ; } try { $ css = $ this -> compile ( $ less , $ options [ 'cache' ] , $ options [ 'parser' ] , $ modifyVars ) ; if ( isset ( $ options [ 'tag' ] ) && ! $ options [ 'tag' ] ) { return $ css ; } if ( ! $ options [ 'cache' ] ) { return $ this -> Html -> formatTemplate ( 'style' , [ 'content' => $ css ] ) ; } return $ this -> Html -> css ( $ css ) ; } catch ( \ Exception $ e ) { // env must be development in order to see errors on-screen if ( Configure :: read ( 'debug' ) ) { $ options [ 'js' ] [ 'env' ] = 'development' ; } $ this -> error = $ e -> getMessage ( ) ; Log :: write ( 'error' , "Error compiling less file: " . $ this -> error ) ; return $ this -> jsBlock ( $ less , $ options ) ; } }
Compiles any less files passed and returns the compiled css.
In case of error, it will load less with the javascritp parser so you'll be
able to see any errors on screen. If not, check out the error.log file in your
CakePHP's logs folder.

@param  mixed $less         The input .less file to be compiled or an array
of .less files.
@param  array  $options     Options in 'js' key will be pased to the less.js
parser and options in 'parser' will be passed to the less.php parser.
@param  array  $modifyVars  Array of modify vars.
@return string
Compiles any less files passed and returns the compiled css . In case of error it will load less with the javascritp parser so you ll be able to see any errors on screen . If not check out the error . log file in your CakePHP s logs folder .