Compile file $in to file $out if $in is newer than $out Returns true when it compiles, false otherwise
static type
ccompile
(type $in, type $out, [self $less = null])
-
type
$in: X
-
type
$out: X
-
self
$less: X
Compile execute
static type
cexecute
(type $in, [type $force = false], [self $less = null])
-
type
$in: X
-
type
$force: X
-
self
$less: X
Compresslist
static array
compressList
(array $items, string $delim)
-
array
$items: Items
-
string
$delim: Delimiter
Quote for regular expression
static string
preg_quote
(string $what)
-
string
$what: What to quote
Initialize any static state, can initialize parser for a file
FOFLess
__construct
([type $fname = null])
Add import dir
void
addImportDir
(type $dir)
Add parsed file
void
addParsedFile
(type $file)
All parsed files
type
allParsedFiles
()
Assert color
type
assertColor
(type $value, [type $error = "expected color value"])
-
type
$value: X
-
type
$error: X
Assert number
type
assertNumber
(type $value, [type $error = "expecting number"])
-
type
$value: X
-
type
$error: X
Execute lessphp on a .less file or a lessphp cache structure
The lessphp cache structure contains information about a specific less file having been parsed. It can be used as a hint for future calls to determine whether or not a rebuild is required.
The cache structure contains two important keys that may be used externally:
compiled: The final compiled CSS updated: The time (in seconds) the CSS was last compiled
The cache structure is a plain-ol' PHP associative array and can be serialized and unserialized without a hitch.
array
cachedCompile
(mixed $in, [bool $force = false])
-
mixed
$in: Input
-
bool
$force: Force rebuild?
Compile only if changed input has changed or output doesn't exist
boolean
checkedCompile
(type $in, type $out)
Clamp
type
clamp
(type $v, [type $max = 1], [type $min = 0])
-
type
$v: X
-
type
$max: X
-
type
$min: X
Coerce a value for use in color operation
null
coerceColor
(type $value)
Make something string like into a string
null
coerceString
(type $value)
Helper function to get arguments for color manipulation functions.
takes a list that contains a color like thing and a percentage
array
colorArgs
(array $args)
Compile
type
compile
(type $string, [type $name = null])
-
type
$string: X
-
type
$name: X
Recursively compiles a block.
A block is analogous to a CSS block in most cases. A single LESS document is encapsulated in a block when parsed, but it does not have parent tags so all of it's children appear on the root level when compiled.
Blocks are made up of props and children.
Props are property instructions, array tuples which describe an action to be taken, eg. write a property, set a variable, mixin a block.
The children of a block are just all the blocks that are defined within. This is used to look up mixins when performing a mixin.
Compiling the block involves pushing a fresh environment on the stack, and iterating through the props, compiling each one.
void
compileBlock
(stdClass $block)
Compile CSS block
void
compileCSSBlock
(stdClass $block)
-
stdClass
$block: Block to compile
Compile file
type
compileFile
(type $fname, [type $outFname = null])
-
type
$fname: X
-
type
$outFname: X
Compile Imported Props
void
compileImportedProps
(
array $props,
stdClass $block,
string $out,
FOFLessParser $sourceParser,
string $importDir)
-
array
$props: Props
-
stdClass
$block: Block
-
string
$out: Out
-
FOFLessParser
$sourceParser: Source parser
-
string
$importDir: Import dir
Compile media
void
compileMedia
(stdClass $media)
Compile media query
string
compileMediaQuery
(type $queries)
Compile nested block
void
compileNestedBlock
(stdClass $block, array $selectors)
-
stdClass
$block: Block
-
array
$selectors: Selectors
Compile a prop and update $lines or $blocks appropriately
void
compileProp
(array $prop, stdClass $block, string $out)
-
array
$prop: Prop
-
stdClass
$block: Block
-
string
$out: Out
Compile props
void
compileProps
(type $block, type $out)
-
type
$block: Something
-
type
$out: Something
Compile root
void
compileRoot
(stdClass $root)
Reduces selector expressions
array
compileSelectors
(array $selectors)
-
array
$selectors: The selector expressions
Compiles a primitive value into a CSS property value.
Values in lessphp are typed by being wrapped in arrays, their format is typically:
array(type, contents [, additional_contents]*)
The input is expected to be reduced. This function will not work on things like expressions and variables.
void
compileValue
(array $value)
Equality check
boolean
eq
(mixed $left, mixed $right)
-
mixed
$left: Left operand
-
mixed
$right: Right operand
Evaluate an expression
type
evaluate
(type $exp)
Expand parent selectors
type
expandParentSelectors
(type &$tag, type $replace)
-
type
&$tag: Tag
-
type
$replace: Replace
Does file $name exists? It's a simple proxy to JFile for now
boolean
fileExists
(string $name)
-
string
$name: The file we check for existence
Attempt to find blocks matched by path and args
null
findBlocks
(array $searchIn, string $path, array $args, [array $seen = array()])
-
array
$searchIn: Block to search in
-
string
$path: The path to search for
-
array
$args: Arguments
-
array
$seen: Your guess is as good as mine; that's third party code
Find closest selectors
array
findClosestSelectors
()
Attempts to find the path of an import url, returns null for css files
string|null
findImport
(string $url)
-
string
$url: The URL of the import
Make sure a color's components don't go out of bounds
int
fixColor
(type $c)
Turn list of length 1 into value type
type
flattenList
(type $value)
Convert the rgb, rgba, hsl color literals of function type as returned by the parser into values of color type.
type
funcToColor
(type $func)
Get the highest occurrence entry for a name
type
get
(type $name, [type $default = null])
-
type
$name: X
-
type
$default: X
Inject array of unparsed strings into environment as variables
void
injectVariables
(type $args)
Get the alpha of a color Defaults to 1 for non-colors or colors without an alpha
string
lib_alpha
(string $value)
Lib argb
type
lib_argb
(type $color)
Lib blue
type
lib_blue
(type $color)
Lib ceil
array
lib_ceil
(type $arg)
Third party code; your guess is as good as mine
string
lib_contrast
( $args, array $arg)
Lib darken
type
lib_darken
(type $args)
Lib desaturate
type
lib_desaturate
(type $args)
Utility func to unquote a string
string
lib_e
(string $arg)
Set the alpha of the color
string
lib_fade
(array $args)
Lib fadein
type
lib_fadein
(type $args)
Lib fadeout
type
lib_fadeout
(type $args)
Lib floor
array
lib_floor
(type $arg)
Lib green
type
lib_green
(type $color)
Lib hue
type
lib_hue
(type $color)
Lib is color
boolean
lib_iscolor
(type $value)
Lib is em
boolean
lib_isem
(type $value)
Lib is keyword
boolean
lib_iskeyword
(type $value)
Lib is number
boolean
lib_isnumber
(type $value)
Lib is percentage
boolean
lib_ispercentage
(type $value)
Lib is pixel
boolean
lib_ispixel
(type $value)
Lib is rem
boolean
lib_isrem
(type $value)
Lib is string
boolean
lib_isstring
(type $value)
Lib lighten
type
lib_lighten
(type $args)
Lib lightness
type
lib_lightness
(type $color)
mixes two colors by weight mix(@color1, @color2, @weight); http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method
string
lib_mix
(array $args)
Third party code; your guess is as good as mine
string
lib_percentage
(array $arg)
Lib red
type
lib_red
(type $color)
LIb rgba hex
boolean
lib_rgbahex
(type $color)
Lib round
array
lib_round
(type $arg)
Lib saturate
type
lib_saturate
(type $args)
Lib saturation
type
lib_saturation
(type $color)
Lib spin
type
lib_spin
(type $args)
Lib unit
array
lib_unit
(type $arg)
Lib sprintf
type
lib__sprintf
(type $args)
Make output block
stdclass
makeOutputBlock
(type $type, [type $selectors = null])
-
type
$type: X
-
type
$selectors: X
Media parent
stdClass
mediaParent
(stdClass $scope)
Multiply media
type
multiplyMedia
(type $env, [type $childQueries = null])
-
type
$env: X
-
type
$childQueries: X
Multiply $selectors against the nearest selectors in env
array
multiplySelectors
(array $selectors)
-
array
$selectors: The selectors
Op color color
type
op_color_color
(type $op, type $left, type $right)
-
type
$op: X
-
type
$left: X
-
type
$right: X
Op color number
type
op_color_number
(type $op, type $lft, int $rgt)
-
type
$op: X
-
type
$lft: X
-
int
$rgt: X
Op number color
type
op_number_color
(type $op, type $lft, type $rgt)
-
type
$op: X
-
type
$lft: X
-
type
$rgt: X
Operator on two numbers
type
op_number_number
(type $op, type $left, type $right)
-
type
$op: X
-
type
$left: X
-
type
$right: X
Parse and compile buffer
type
parse
([null $str = null], [type $initialVariables = null])
-
null
$str: X
-
type
$initialVariables: X
Pattern match
boolean
patternMatch
(type $block, type $callingArgs)
-
type
$block: X
-
type
$callingArgs: X
Pattern match all
type
patternMatchAll
(type $blocks, type $callingArgs)
-
type
$blocks: X
-
type
$callingArgs: X
Pop something off the stack
type
popEnv
()
The state of execution
stdclass
pushEnv
([type $block = null])
Reduce
type
reduce
(type $value, [type $forExpression = false])
-
type
$value: X
-
type
$forExpression: X
Register function
void
registerFunction
(type $name, type $func)
-
type
$name: X
-
type
$func: X
Set something in the current env
void
set
(type $name, type $value)
-
type
$name: X
-
type
$value: X
Set Formatter
void
setFormatter
(type $name)
Set import dir
void
setImportDir
(type $dirs)
Set preserve comments
void
setPreserveComments
(type $preserve)
Set variables
void
setVariables
(type $variables)
Sort props
type
sortProps
(type $props, [type $split = false])
-
type
$props: X
-
type
$split: X
String concatenate
string
stringConcatenate
(type $left, string $right)
-
type
$left: X
-
string
$right: X
Uses the current value of $this->count to show line and line number
void
throwError
([type $msg = null])
To bool
type
toBool
(type $a)
To HSL
type
toHSL
(type $color)
Converts a hsl array into a color value in rgb.
Expects H to be in range of 0 to 360, S and L in 0 to 100
type
toRGB
(type $color)
To RGB helper
type
toRGB_helper
(type $comp, type $temp1, type $temp2)
-
type
$comp: X
-
type
$temp1: X
-
type
$temp2: X
Try import
boolean
tryImport
(string $importPath, stdObject $parentBlock, string $out)
-
string
$importPath: Import path
-
stdObject
$parentBlock: Parent block
-
string
$out: Out
Unregister function
void
unregisterFunction
(type $name)
Unset variable
void
unsetVariable
(type $name)
Sets all argument names in $args to either the default value or the one passed in through $values
void
zipSetArgs
(array $args, array $values)
-
array
$args: Arguments
-
array
$values: Values