engine.lessphp.inc in Less CSS Preprocessor 7.4        
                          
                  
                        
  
  
  
File
  engines/engine.lessphp.inc
  
    View source  
  <?php
class LessEngineLessphp extends LessEngine {
  
  private $less_php_parser;
  
  public function __construct($input_file_path) {
    parent::__construct($input_file_path);
    $this->less_php_parser = new lessc();
  }
  
  public function compile() {
    $compiled_styles = NULL;
    try {
      foreach ($this->import_directories as $directory) {
        $this->less_php_parser
          ->addImportDir($directory);
      }
      $cache = $this->less_php_parser
        ->cachedCompile($this->input_file_path);
      $this->dependencies = array_keys($cache['files']);
      $compiled_styles = $cache['compiled'];
    } catch (Exception $e) {
      throw $e;
    }
    return $compiled_styles;
  }
}