PHP 클래스 Beans_Lessc, Beans

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 intstance 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.
파일 보기 프로젝트 열기: Getbeans/Beans 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$VERSION
$defaultValue
$importDir
$importDisabled
$mPrefix prefix of abstract properties
$parentSelector prefix of abstract blocks
$vPrefix

보호된 프로퍼티들

프로퍼티 타입 설명
$FALSE
$TRUE
$allParsedFiles
$cssColors
$libFunctions
$nextImportId
$numberPrecision
$preserveComments
$registeredVars
$sourceLoc
$sourceParser so we know how to create error messages

공개 메소드들

메소드 설명
__construct ( $fname = null ) Initialize any static state, can initialize parser for a file $opts isn't used yet
addImportDir ( $dir )
allParsedFiles ( )
cachedCompile ( mixed $in, boolean $force = false ) : array Execute lessphp on a .less file or a lessphp cache structure
ccompile ( $in, $out, $less = null ) returns true when it compiles, false otherwise
cexecute ( $in, $force = false, $less = null )
checkedCompile ( $in, $out ) compile only if changed input has changed or output doesn't exist
compile ( $string, $name = null )
compileFile ( $fname, $outFname = null )
compressList ( $items, $delim )
lib_blue ( $color )
lib_green ( $color )
lib_red ( $color )
parse ( $str = null, $initialVariables = null ) This is deprecated
preg_quote ( $what )
registerFunction ( $name, $func )
setFormatter ( $name )
setImportDir ( $dirs )
setPreserveComments ( $preserve )
setVariables ( $variables )
unregisterFunction ( $name )
unsetVariable ( $name )

보호된 메소드들

메소드 설명
addParsedFile ( $file )
assertArgs ( $value, $expectedArgs, $name = "" )
assertColor ( $value, $error = "expected color value" )
assertNumber ( $value, $error = "expecting number" )
clamp ( $v, $max = 1, $min )
coerceColor ( $value ) coerce a value for use in color operation
coerceString ( $value ) make something string like into a string
colorArgs ( $args ) Helper function to get arguments for color manipulation functions.
compileBlock ( $block ) Recursively compiles a block.
compileCSSBlock ( $block )
compileImportedProps ( $props, $block, $out, $sourceParser, $importDir )
compileMedia ( $media )
compileMediaQuery ( $queries )
compileNestedBlock ( $block, $selectors )
compileProp ( $prop, $block, $out ) compile a prop and update $lines or $blocks appropriately
compileProps ( $block, $out )
compileRoot ( $root )
compileSelectors ( $selectors ) reduces selector expressions
compileValue ( $value ) Compiles a primitive value into a CSS property value.
eq ( $left, $right )
evaluate ( $exp ) evaluate an expression
expandParentSelectors ( &$tag, $replace )
fileExists ( $name )
findBlocks ( $searchIn, $path, $orderedArgs, $keywordArgs, $seen = [] ) attempt to find blocks matched by path and args
findClosestSelectors ( )
findImport ( $url ) attempts to find the path of an import url, returns null for css files
fixColor ( $c ) make sure a color's components don't go out of bounds
flattenList ( $value ) turn list of length 1 into value type
funcToColor ( $func ) Convert the rgb, rgba, hsl color literals of function type as returned by the parser into values of color type.
get ( $name, $default = null ) get the highest occurrence entry for a name
injectVariables ( $args ) inject array of unparsed strings into environment as variables
lib__sprintf ( $args )
lib_acos ( $num )
lib_alpha ( $value ) defaults to 1 for non-colors or colors without an alpha
lib_argb ( $color )
lib_asin ( $num )
lib_atan ( $num )
lib_ceil ( $arg )
lib_contrast ( $args )
lib_cos ( $num )
lib_darken ( $args )
lib_desaturate ( $args )
lib_e ( ) use func_get_arg to prevent Theme Checker triggering unrelated translation warning.
lib_extract ( $value )
lib_fade ( $args ) set the alpha of the color
lib_fadein ( $args )
lib_fadeout ( $args )
lib_floor ( $arg )
lib_hue ( $color )
lib_iscolor ( $value )
lib_isem ( $value )
lib_iskeyword ( $value )
lib_isnumber ( $value )
lib_ispercentage ( $value )
lib_ispixel ( $value )
lib_isrem ( $value )
lib_isstring ( $value )
lib_lighten ( $args )
lib_lightness ( $color )
lib_mix ( $args ) http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method
lib_mod ( $args )
lib_percentage ( $arg )
lib_pi ( )
lib_pow ( $args )
lib_rgbahex ( $color )
lib_round ( $arg )
lib_saturate ( $args )
lib_saturation ( $color )
lib_sin ( $num )
lib_spin ( $args )
lib_sqrt ( $num )
lib_tan ( $num )
lib_unit ( $arg )
lib_unquote ( $arg ) use func_get_arg to prevent Theme Checker triggering unrelated translation warning.
makeOutputBlock ( $type, $selectors = null ) * environment functions
makeParser ( $name )
mediaParent ( $scope )
multiplyMedia ( $env, $childQueries = null )
multiplySelectors ( $selectors ) multiply $selectors against the nearest selectors in env
newFormatter ( )
op_color_color ( $op, $left, $right )
op_color_number ( $op, $lft, $rgt )
op_number_color ( $op, $lft, $rgt )
op_number_number ( $op, $left, $right ) operator on two numbers
patternMatch ( $block, $orderedArgs, $keywordArgs )
patternMatchAll ( $blocks, $orderedArgs, $keywordArgs, $skip = [] )
popEnv ( ) pop something off the stack
pushEnv ( $block = null ) the state of execution
reduce ( $value, $forExpression = false )
set ( $name, $value ) set something in the current env
sortProps ( $props, $split = false )
stringConcatenate ( $left, $right )
throwError ( $msg = null ) Uses the current value of $this->count to show line and line number
toBool ( $a )
toHSL ( $color )
toRGB ( $color ) Converts a hsl array into a color value in rgb.
toRGB_helper ( $comp, $temp1, $temp2 )
tryImport ( $importPath, $parentBlock, $out )
zipSetArgs ( $args, $orderedValues, $keywordValues ) or the one passed in through $values

메소드 상세

__construct() 공개 메소드

Initialize any static state, can initialize parser for a file $opts isn't used yet
public __construct ( $fname = null )

addImportDir() 공개 메소드

public addImportDir ( $dir )

addParsedFile() 보호된 메소드

protected addParsedFile ( $file )

allParsedFiles() 공개 메소드

public allParsedFiles ( )

assertArgs() 보호된 메소드

protected assertArgs ( $value, $expectedArgs, $name = "" )

assertColor() 보호된 메소드

protected assertColor ( $value, $error = "expected color value" )

assertNumber() 보호된 메소드

protected assertNumber ( $value, $error = "expecting number" )

cachedCompile() 공개 메소드

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.
public cachedCompile ( mixed $in, boolean $force = false ) : array
$in mixed Input
$force boolean Force rebuild?
리턴 array lessphp cache structure

ccompile() 공개 정적인 메소드

returns true when it compiles, false otherwise
public static ccompile ( $in, $out, $less = null )

cexecute() 공개 정적인 메소드

public static cexecute ( $in, $force = false, $less = null )

checkedCompile() 공개 메소드

compile only if changed input has changed or output doesn't exist
public checkedCompile ( $in, $out )

clamp() 보호된 메소드

protected clamp ( $v, $max = 1, $min )

coerceColor() 보호된 메소드

coerce a value for use in color operation
protected coerceColor ( $value )

coerceString() 보호된 메소드

make something string like into a string
protected coerceString ( $value )

colorArgs() 보호된 메소드

takes a list that contains a color like thing and a percentage
protected colorArgs ( $args )

compile() 공개 메소드

public compile ( $string, $name = null )

compileBlock() 보호된 메소드

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. See lessc::compileProp()
protected compileBlock ( $block )

compileCSSBlock() 보호된 메소드

protected compileCSSBlock ( $block )

compileFile() 공개 메소드

public compileFile ( $fname, $outFname = null )

compileImportedProps() 보호된 메소드

protected compileImportedProps ( $props, $block, $out, $sourceParser, $importDir )

compileMedia() 보호된 메소드

protected compileMedia ( $media )

compileMediaQuery() 보호된 메소드

protected compileMediaQuery ( $queries )

compileNestedBlock() 보호된 메소드

protected compileNestedBlock ( $block, $selectors )

compileProp() 보호된 메소드

compile a prop and update $lines or $blocks appropriately
protected compileProp ( $prop, $block, $out )

compileProps() 보호된 메소드

protected compileProps ( $block, $out )

compileRoot() 보호된 메소드

protected compileRoot ( $root )

compileSelectors() 보호된 메소드

reduces selector expressions
protected compileSelectors ( $selectors )

compileValue() 보호된 메소드

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.
protected compileValue ( $value )

compressList() 공개 정적인 메소드

public static compressList ( $items, $delim )

eq() 보호된 메소드

protected eq ( $left, $right )

evaluate() 보호된 메소드

evaluate an expression
protected evaluate ( $exp )

expandParentSelectors() 보호된 메소드

protected expandParentSelectors ( &$tag, $replace )

fileExists() 보호된 메소드

protected fileExists ( $name )

findBlocks() 보호된 메소드

attempt to find blocks matched by path and args
protected findBlocks ( $searchIn, $path, $orderedArgs, $keywordArgs, $seen = [] )

findClosestSelectors() 보호된 메소드

protected findClosestSelectors ( )

findImport() 보호된 메소드

attempts to find the path of an import url, returns null for css files
protected findImport ( $url )

fixColor() 보호된 메소드

make sure a color's components don't go out of bounds
protected fixColor ( $c )

flattenList() 보호된 메소드

turn list of length 1 into value type
protected flattenList ( $value )

funcToColor() 보호된 메소드

Convert the rgb, rgba, hsl color literals of function type as returned by the parser into values of color type.
protected funcToColor ( $func )

get() 보호된 메소드

get the highest occurrence entry for a name
protected get ( $name, $default = null )

injectVariables() 보호된 메소드

inject array of unparsed strings into environment as variables
protected injectVariables ( $args )

lib__sprintf() 보호된 메소드

protected lib__sprintf ( $args )

lib_acos() 보호된 메소드

protected lib_acos ( $num )

lib_alpha() 보호된 메소드

defaults to 1 for non-colors or colors without an alpha
protected lib_alpha ( $value )

lib_argb() 보호된 메소드

protected lib_argb ( $color )

lib_asin() 보호된 메소드

protected lib_asin ( $num )

lib_atan() 보호된 메소드

protected lib_atan ( $num )

lib_blue() 공개 메소드

public lib_blue ( $color )

lib_ceil() 보호된 메소드

protected lib_ceil ( $arg )

lib_contrast() 보호된 메소드

protected lib_contrast ( $args )

lib_cos() 보호된 메소드

protected lib_cos ( $num )

lib_darken() 보호된 메소드

protected lib_darken ( $args )

lib_desaturate() 보호된 메소드

protected lib_desaturate ( $args )

lib_e() 보호된 메소드

use func_get_arg to prevent Theme Checker triggering unrelated translation warning.
protected lib_e ( )

lib_extract() 보호된 메소드

protected lib_extract ( $value )

lib_fade() 보호된 메소드

set the alpha of the color
protected lib_fade ( $args )

lib_fadein() 보호된 메소드

protected lib_fadein ( $args )

lib_fadeout() 보호된 메소드

protected lib_fadeout ( $args )

lib_floor() 보호된 메소드

protected lib_floor ( $arg )

lib_green() 공개 메소드

public lib_green ( $color )

lib_hue() 보호된 메소드

protected lib_hue ( $color )

lib_iscolor() 보호된 메소드

protected lib_iscolor ( $value )

lib_isem() 보호된 메소드

protected lib_isem ( $value )

lib_iskeyword() 보호된 메소드

protected lib_iskeyword ( $value )

lib_isnumber() 보호된 메소드

protected lib_isnumber ( $value )

lib_ispercentage() 보호된 메소드

protected lib_ispercentage ( $value )

lib_ispixel() 보호된 메소드

protected lib_ispixel ( $value )

lib_isrem() 보호된 메소드

protected lib_isrem ( $value )

lib_isstring() 보호된 메소드

protected lib_isstring ( $value )

lib_lighten() 보호된 메소드

protected lib_lighten ( $args )

lib_lightness() 보호된 메소드

protected lib_lightness ( $color )

lib_mix() 보호된 메소드

http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method
protected lib_mix ( $args )

lib_mod() 보호된 메소드

protected lib_mod ( $args )

lib_percentage() 보호된 메소드

protected lib_percentage ( $arg )

lib_pi() 보호된 메소드

protected lib_pi ( )

lib_pow() 보호된 메소드

protected lib_pow ( $args )

lib_red() 공개 메소드

public lib_red ( $color )

lib_rgbahex() 보호된 메소드

protected lib_rgbahex ( $color )

lib_round() 보호된 메소드

protected lib_round ( $arg )

lib_saturate() 보호된 메소드

protected lib_saturate ( $args )

lib_saturation() 보호된 메소드

protected lib_saturation ( $color )

lib_sin() 보호된 메소드

protected lib_sin ( $num )

lib_spin() 보호된 메소드

protected lib_spin ( $args )

lib_sqrt() 보호된 메소드

protected lib_sqrt ( $num )

lib_tan() 보호된 메소드

protected lib_tan ( $num )

lib_unit() 보호된 메소드

protected lib_unit ( $arg )

lib_unquote() 보호된 메소드

use func_get_arg to prevent Theme Checker triggering unrelated translation warning.
protected lib_unquote ( $arg )

makeOutputBlock() 보호된 메소드

* environment functions
protected makeOutputBlock ( $type, $selectors = null )

makeParser() 보호된 메소드

protected makeParser ( $name )

mediaParent() 보호된 메소드

protected mediaParent ( $scope )

multiplyMedia() 보호된 메소드

protected multiplyMedia ( $env, $childQueries = null )

multiplySelectors() 보호된 메소드

multiply $selectors against the nearest selectors in env
protected multiplySelectors ( $selectors )

newFormatter() 보호된 메소드

protected newFormatter ( )

op_color_color() 보호된 메소드

protected op_color_color ( $op, $left, $right )

op_color_number() 보호된 메소드

protected op_color_number ( $op, $lft, $rgt )

op_number_color() 보호된 메소드

protected op_number_color ( $op, $lft, $rgt )

op_number_number() 보호된 메소드

operator on two numbers
protected op_number_number ( $op, $left, $right )

parse() 공개 메소드

This is deprecated
public parse ( $str = null, $initialVariables = null )

patternMatch() 보호된 메소드

protected patternMatch ( $block, $orderedArgs, $keywordArgs )

patternMatchAll() 보호된 메소드

protected patternMatchAll ( $blocks, $orderedArgs, $keywordArgs, $skip = [] )

popEnv() 보호된 메소드

pop something off the stack
protected popEnv ( )

preg_quote() 공개 정적인 메소드

public static preg_quote ( $what )

pushEnv() 보호된 메소드

the state of execution
protected pushEnv ( $block = null )

reduce() 보호된 메소드

protected reduce ( $value, $forExpression = false )

registerFunction() 공개 메소드

public registerFunction ( $name, $func )

set() 보호된 메소드

set something in the current env
protected set ( $name, $value )

setFormatter() 공개 메소드

public setFormatter ( $name )

setImportDir() 공개 메소드

public setImportDir ( $dirs )

setPreserveComments() 공개 메소드

public setPreserveComments ( $preserve )

setVariables() 공개 메소드

public setVariables ( $variables )

sortProps() 보호된 메소드

protected sortProps ( $props, $split = false )

stringConcatenate() 보호된 메소드

protected stringConcatenate ( $left, $right )

throwError() 보호된 메소드

Uses the current value of $this->count to show line and line number
protected throwError ( $msg = null )

toBool() 보호된 메소드

protected toBool ( $a )

toHSL() 보호된 메소드

protected toHSL ( $color )

toRGB() 보호된 메소드

Expects H to be in range of 0 to 360, S and L in 0 to 100
protected toRGB ( $color )

toRGB_helper() 보호된 메소드

protected toRGB_helper ( $comp, $temp1, $temp2 )

tryImport() 보호된 메소드

protected tryImport ( $importPath, $parentBlock, $out )

unregisterFunction() 공개 메소드

public unregisterFunction ( $name )

unsetVariable() 공개 메소드

public unsetVariable ( $name )

zipSetArgs() 보호된 메소드

or the one passed in through $values
protected zipSetArgs ( $args, $orderedValues, $keywordValues )

프로퍼티 상세

$FALSE 보호되어 있는 정적으로 프로퍼티

protected static $FALSE

$TRUE 보호되어 있는 정적으로 프로퍼티

protected static $TRUE

$VERSION 공개적으로 정적으로 프로퍼티

public static $VERSION

$allParsedFiles 보호되어 있는 프로퍼티

protected $allParsedFiles

$cssColors 보호되어 있는 정적으로 프로퍼티

protected static $cssColors

$defaultValue 공개적으로 정적으로 프로퍼티

public static $defaultValue

$importDir 공개적으로 프로퍼티

public $importDir

$importDisabled 공개적으로 프로퍼티

public $importDisabled

$libFunctions 보호되어 있는 프로퍼티

protected $libFunctions

$mPrefix 공개적으로 프로퍼티

prefix of abstract properties
public $mPrefix

$nextImportId 보호되어 있는 정적으로 프로퍼티

protected static $nextImportId

$numberPrecision 보호되어 있는 프로퍼티

protected $numberPrecision

$parentSelector 공개적으로 프로퍼티

prefix of abstract blocks
public $parentSelector

$preserveComments 보호되어 있는 프로퍼티

protected $preserveComments

$registeredVars 보호되어 있는 프로퍼티

protected $registeredVars

$sourceLoc 보호되어 있는 프로퍼티

protected $sourceLoc

$sourceParser 보호되어 있는 프로퍼티

so we know how to create error messages
protected $sourceParser

$vPrefix 공개적으로 프로퍼티

public $vPrefix