Parse and compile Less files into CSS.
More...
|
| __construct ( $env=null) |
|
| Reset ( $options=null) |
| Reset the parser state completely.
|
|
| SetOptions ( $options) |
| Set one or more compiler options options: import_dirs, cache_dir, cache_method.
|
|
| SetOption ( $option, $value) |
| Set one compiler option.
|
|
| registerFunction ( $name, $callback) |
| Registers a new custom function.
|
|
| unregisterFunction ( $name) |
| Removed an already registered function.
|
|
| getCss () |
| Get the current css buffer.
|
|
| findValueOf ( $varName) |
|
| getVariables () |
| Gets the private rules variable and returns an array of the found variables it uses a helper method getVariableValue() that contains the logic ot fetch the value from the rule object.
|
|
| findVarByName ( $var_name) |
|
| parse ( $str, $file_uri=null) |
| Parse a Less string.
|
|
| parseFile ( $filename, $uri_root='', $returnRoot=false) |
| Parse a Less string from a given file.
|
|
| ModifyVars ( $vars) |
| Allows a user to set variables values.
|
|
| SetFileInfo ( $filename, $uri_root='') |
|
| SetCacheDir ( $dir) |
|
| SetImportDirs ( $dirs) |
| Set a list of directories or callbacks the parser should use for determining import paths.
|
|
| SetInput ( $file_path) |
|
| UnsetInput () |
|
| CacheFile ( $file_path) |
|
| getParsedFiles () |
|
| save () |
|
| Error ( $msg) |
|
| CacheEnabled () |
|
|
static | AllParsedFiles () |
|
static | serializeVars ( $vars) |
|
static | is_method ( $a, $b) |
| Some versions of PHP have trouble with method_exists($a,$b) if $a is not an object.
|
|
static | round ( $input, $precision=0) |
| Round numbers similarly to javascript eg: 1.499999 to 1 instead of 2.
|
|
static | WinPath ( $path) |
|
static | AbsPath ( $path, $winPath=false) |
|
|
static | $default_options |
|
static | $options = [] |
|
static | $has_extends = false |
|
static | $next_id = 0 |
|
static | $contentsMap = [] |
|
Parse and compile Less files into CSS.
◆ __construct()
Less_Parser::__construct |
( |
| $env = null | ) |
|
- Parameters
-
Less_Environment | array | null | $env | |
◆ AllParsedFiles()
static Less_Parser::AllParsedFiles |
( |
| ) |
|
|
static |
◆ Error()
Less_Parser::Error |
( |
| $msg | ) |
|
◆ getCss()
Get the current css buffer.
- Returns
- string
◆ getParsedFiles()
Less_Parser::getParsedFiles |
( |
| ) |
|
- Since
- 4.3.0
- Returns
- string[]
◆ getVariables()
Less_Parser::getVariables |
( |
| ) |
|
Gets the private rules variable and returns an array of the found variables it uses a helper method getVariableValue() that contains the logic ot fetch the value from the rule object.
- Returns
- array
◆ is_method()
static Less_Parser::is_method |
( |
| $a, |
|
|
| $b ) |
|
static |
Some versions of PHP have trouble with method_exists($a,$b) if $a is not an object.
- Parameters
-
◆ ModifyVars()
Less_Parser::ModifyVars |
( |
| $vars | ) |
|
Allows a user to set variables values.
- Parameters
-
- Returns
- $this
◆ parse()
Less_Parser::parse |
( |
| $str, |
|
|
| $file_uri = null ) |
Parse a Less string.
- Exceptions
-
- Parameters
-
string | $str | The string to convert |
string | null | $file_uri | The url of the file |
- Returns
- $this
◆ parseFile()
Less_Parser::parseFile |
( |
| $filename, |
|
|
| $uri_root = '', |
|
|
| $returnRoot = false ) |
Parse a Less string from a given file.
- Exceptions
-
- Parameters
-
string | $filename | The file to parse |
string | $uri_root | The url of the file |
bool | $returnRoot | Indicates whether the return value should be a css string a root node |
- Returns
- Less_Tree_Ruleset|$this
◆ registerFunction()
Less_Parser::registerFunction |
( |
| $name, |
|
|
| $callback ) |
Registers a new custom function.
- Parameters
-
string | $name | function name |
callable | $callback | callback |
◆ SetCacheDir()
Less_Parser::SetCacheDir |
( |
| $dir | ) |
|
◆ SetFileInfo()
Less_Parser::SetFileInfo |
( |
| $filename, |
|
|
| $uri_root = '' ) |
- Parameters
-
string | $filename | |
string | $uri_root | |
◆ SetImportDirs()
Less_Parser::SetImportDirs |
( |
| $dirs | ) |
|
Set a list of directories or callbacks the parser should use for determining import paths.
Import closures are called with a single $path
argument containing the unquoted @import
string an input LESS file. The string is unchanged, except for a statically appended ".less" suffix if the basename does not yet contain a dot. If a dot is present in the filename, you are responsible for choosing whether to expand "foo.bar" to "foo.bar.less". If your callback can handle this import statement, return an array with an absolute file path and an optional URI path, or return void/null to indicate that your callback does not handle this import statement.
Example:
function ( $path ) {
if ( $path === 'virtual/something.less' ) {
return [ '/srv/elsewhere/thing.less', null ];
}
}
- Parameters
-
array<string|callable> | $dirs The key should be a server directory from which LESS files may be imported. The value is an optional public URL or URL base path that corresponds to the same directory (use empty string otherwise). The value may also be a closure, in which case the key is ignored. |
◆ unregisterFunction()
Less_Parser::unregisterFunction |
( |
| $name | ) |
|
Removed an already registered function.
- Parameters
-
The documentation for this class was generated from the following file: