Class lessc
The LESS compiler and parser.
Converting LESS to CSS is a three stage process. The incoming file is parsed
by lessc_parser
into a syntax tree, then it is compiled into
another tree representing the CSS structure by lessc
. The CSS tree
is fed into a formatter, like lessc_formatter
which then outputs
CSS as a string.
During the first compile, all values are reduced, which means that their types are brought to the lowest form before being dump as strings. This handles math equations, variable dereferences, and the like.
The parse
function of lessc
is the entry point.
In summary:
The lessc
class creates an instance of the parser, feeds it LESS
code, then transforms the resulting tree to a CSS tree. This class also holds
the evaluation context, such as all available mixins and variables at any given
time.
The lessc_parser
class is only concerned with parsing its
input.
The lessc_formatter
takes a CSS tree, and dumps it to a
formatted string, handling things like indentation.
Methods summary
protected
|
|
protected
|
|
public static
|
|
public static
|
|
protected
|
|
protected
|
#
compileImportedProps( mixed $props, mixed $block, mixed $out, mixed $sourceParser, mixed $importDir )
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
#
deduplicate( mixed $lines )
Deduplicate lines in a block. Comments are not deduplicated. If a duplicate rule is detected, the comments immediately preceding each occurence are consolidated. |
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
#
findBlocks( mixed $searchIn, mixed $path, mixed $orderedArgs, mixed $keywordArgs, mixed $seen = array() )
|
protected
|
|
protected
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
string
|
#
lib_data_uri( array $value )
Given an url, decide whether to output a regular link or the base64-encoded contents of the file |
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
public
|
|
public
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
#
funcToColor( mixed $func )
Convert the rgb, rgba, hsl color literals of function type as returned by the parser into values of color type. |
protected
|
|
protected
|
|
protected
|
|
protected
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
public
|
|
public
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
public
|
#
__construct( mixed $fname = null )
Initialize any static state, can initialize parser for a file $opts isn't used yet |
public
|
|
public
|
|
public
|
|
public
array
|
#
cachedCompile( mixed $in, boolean $force = false )
Execute lessphp on a .less file or a lessphp cache structure |
public
|
|
protected
|
|
public
|
|
protected
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
throwError( mixed $msg = null )
Uses the current value of $this->count to show line and line number |
public static
|
|
public static
|
Magic methods summary
Properties summary
public static
string
|
$VERSION | |
public static
array
|
$TRUE | |
public static
array
|
$FALSE | |
protected
array
|
$libFunctions | |
protected
array
|
$registeredVars | |
protected
boolean
|
$preserveComments | |
public
string
|
$vPrefix | |
public
string
|
$mPrefix | |
public
string
|
$parentSelector | |
public
boolean
|
$importDisabled | |
public
string
|
$importDir | |
protected
mixed
|
$numberPrecision | |
protected
array
|
$allParsedFiles | |
protected
mixed
|
$sourceParser | |
protected
mixed
|
$sourceLoc | |
protected static
integer
|
$nextImportId | |
protected static
array
|
$cssColors |