class LessEngineLess_js in Less CSS Preprocessor 7.4
Same name and namespace in other branches
- 8 engines/engine.less_js.inc \LessEngineLess_js
Class \LessEngineLess_js
Hierarchy
- class \LessEngine implements LessEngineInterface
- class \LessEngineLess_js
Expanded class hierarchy of LessEngineLess_js
1 string reference to 'LessEngineLess_js'
- less_less_engines in ./
less.module - Implements hook_less_engines().
File
- engines/
engine.less_js.inc, line 6
View source
class LessEngineLess_js extends LessEngine {
/**
* @var \Lessjs
*/
private $less_js_parser;
/**
* Instantiates new instances of \Lessjs.
*
* @param string $input_file_path
*
* @see \Lessjs
*/
public function __construct($input_file_path) {
parent::__construct($input_file_path);
$this->less_js_parser = Lessjs::create($this->input_file_path);
}
/**
* We override here because getting dependencies from less.js requires another
* full parse. This way we only do that if dependencies are requested.
*
* @return string[]
*
* @see \Lessjs::depends()
*/
public function getDependencies() {
$this->dependencies = $this->less_js_parser
->depends();
return parent::getDependencies();
}
/**
* {@inheritdoc}
* This compiles using engine specific function calls.
*/
public function compile() {
$compiled_styles = NULL;
try {
$this->less_js_parser
->source_maps($this->source_maps_enabled, $this->source_maps_base_path, $this->source_maps_root_path);
foreach ($this->import_directories as $directory) {
$this->less_js_parser
->include_path($directory);
}
foreach ($this->variables as $var_name => $var_value) {
$this->less_js_parser
->modify_var(trim($var_name, '@'), trim($var_value, ';'));
}
$compiled_styles = $this->less_js_parser
->compile();
} catch (Exception $e) {
throw $e;
}
return $compiled_styles;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LessEngine:: |
protected | property | This will get populated with a list of files that $input_file_path depended on through @import statements. | |
LessEngine:: |
protected | property | List of directories that are to be used for @import lookups. | |
LessEngine:: |
protected | property | Path to the input .less file. | |
LessEngine:: |
protected | property | ||
LessEngine:: |
protected | property | Flag if source maps are enabled. | |
LessEngine:: |
protected | property | ||
LessEngine:: |
protected | property | This contains any variables that are to be modified into the output. | |
LessEngine:: |
public | function |
Set/override variables. Overrides LessEngineInterface:: |
|
LessEngine:: |
public | function |
Set list of lookup directories for @import statements. Overrides LessEngineInterface:: |
|
LessEngine:: |
public | function |
Enable Overrides LessEngineInterface:: |
|
LessEngineLess_js:: |
private | property | ||
LessEngineLess_js:: |
public | function |
This compiles using engine specific function calls. Overrides LessEngineInterface:: |
|
LessEngineLess_js:: |
public | function |
We override here because getting dependencies from less.js requires another
full parse. This way we only do that if dependencies are requested. Overrides LessEngine:: |
|
LessEngineLess_js:: |
public | function |
Instantiates new instances of \Lessjs. Overrides LessEngine:: |