PHP Class SassParser

Parses {@link http://sass-lang.com/ Sass} files.
Afficher le fichier Open project: richthegeek/phpsass Class Usage Examples

Méthodes publiques

Свойство Type Description
$basepath Option
$callbacks callbacks:
$debug Defaults to FALSE
$debug_info debug_info:
$filename filename:
$functions function:
$indentChar the character used for indenting
$indentChars allowable characters for indenting
$indentSpaces number of spaces for indentation. Used to calculate {@link Level} if {@link indentChar} is space.
$instance Static holder for last instance of a SassParser
$line line:
$line_numbers line_numbers:
$load_path_functions
$load_paths load_paths:
$property_syntax property_syntax:
$quiet quiet:
$source source
$style style:
$syntax syntax:

Méthodes publiques

Méthode Description
__construct ( array $options = [] ) : SassParser Constructor.
__get ( string $name ) : mixed Getter.
buildTree ( SassNode $parent ) : SassNode Builds a parse tree under the parent node.
createToken ( string $statement ) : object | null Returns an object that contains the source statement and meta data about it.
getBasepath ( )
getCallbacks ( )
getDebug ( )
getDebug_info ( )
getFilename ( )
getFunctions ( )
getLevel ( string $source ) : integer Returns the level of the line.
getLine ( )
getLine_numbers ( )
getLoad_path_functions ( )
getLoad_paths ( )
getNode ( SassNode $node ) : SassNode | null Creates and returns the next SassNode.
getOptions ( )
getProperty_syntax ( )
getQuiet ( )
getSource ( )
getStyle ( )
getSyntax ( )
getToken ( ) : object Returns a token object that contains the next source statement and meta data about it.
parse ( string $source, boolean $isFile = true ) : SassRootNode Parse a sass file or Sass source code and returns the document tree that can then be rendered.
parseDirective ( stdClass $token, SassNode $parent ) : SassNode Parses a directive
sass2Token ( ) : object Returns an object that contains the next source statement and meta data about it from SASS source.
scss2Token ( ) : object Returns an object that contains the next source statement and meta data about it from SCSS source.
setIndentChar ( ) Determine the indent character and indent spaces.
toCss ( string $source, boolean $isFile = true ) : string Parse a sass file or Sass source code and returns the CSS.
toTree ( string $source ) : SassRootNode Parse Sass source into a document tree.

Method Details

__construct() public méthode

Sets parser options
public __construct ( array $options = [] ) : SassParser
$options array
Résultat SassParser

__get() public méthode

Getter.
public __get ( string $name ) : mixed
$name string name of property to get
Résultat mixed return value of getter function

buildTree() public méthode

Called recursivly until the source is parsed.
public buildTree ( SassNode $parent ) : SassNode
$parent SassNode the node
Résultat SassNode

createToken() public méthode

If the statement is just and end block we update the meta data and return null.
public createToken ( string $statement ) : object | null
$statement string source statement
Résultat object | null

getBasepath() public méthode

public getBasepath ( )

getCallbacks() public méthode

public getCallbacks ( )

getDebug() public méthode

public getDebug ( )

getDebug_info() public méthode

public getDebug_info ( )

getFilename() public méthode

public getFilename ( )

getFunctions() public méthode

public getFunctions ( )

getLevel() public méthode

Used for .sass source
public getLevel ( string $source ) : integer
$source string the source
Résultat integer the level of the source

getLine() public méthode

public getLine ( )

getLine_numbers() public méthode

public getLine_numbers ( )

getLoad_path_functions() public méthode

getLoad_paths() public méthode

public getLoad_paths ( )

getNode() public méthode

The tpye of SassNode depends on the content of the SassToken.
public getNode ( SassNode $node ) : SassNode | null
$node SassNode
Résultat SassNode | null a SassNode of the appropriate type. Null when no more source to parse.

getOptions() public méthode

public getOptions ( )

getProperty_syntax() public méthode

public getProperty_syntax ( )

getQuiet() public méthode

public getQuiet ( )

getSource() public méthode

public getSource ( )

getStyle() public méthode

public getStyle ( )

getSyntax() public méthode

public getSyntax ( )

getToken() public méthode

Returns a token object that contains the next source statement and meta data about it.
public getToken ( ) : object
Résultat object

parse() public méthode

The file will be searched for in the directories specified by the load_paths option.
public parse ( string $source, boolean $isFile = true ) : SassRootNode
$source string name of source file or Sass source
$isFile boolean
Résultat SassRootNode Root node of document tree

parseDirective() public méthode

Parses a directive
public parseDirective ( stdClass $token, SassNode $parent ) : SassNode
$token stdClass token to parse
$parent SassNode parent node
Résultat SassNode a Sass directive node

sass2Token() public méthode

Sass statements are passed over. Statements spanning multiple lines, e.g. CSS comments and selectors, are assembled into a single statement.
public sass2Token ( ) : object
Résultat object Statement token. Null if end of source.

scss2Token() public méthode

Returns an object that contains the next source statement and meta data about it from SCSS source.
public scss2Token ( ) : object
Résultat object Statement token. Null if end of source.

setIndentChar() public méthode

The first character of the first indented line determines the character. If this is a space the number of spaces determines the indentSpaces; this is always 1 if the indent character is a tab. Only used for .sass files.
public setIndentChar ( )

toCss() public méthode

Parse a sass file or Sass source code and returns the CSS.
public toCss ( string $source, boolean $isFile = true ) : string
$source string name of source file or Sass source
$isFile boolean
Résultat string CSS

toTree() public méthode

If the tree is already created return that.
public toTree ( string $source ) : SassRootNode
$source string Sass source
Résultat SassRootNode the root of this document tree

Property Details

$basepath public_oe property

Option
public $basepath

$callbacks public_oe property

callbacks:
public $callbacks

$debug public_oe property

Defaults to FALSE
public $debug

$debug_info public_oe property

debug_info:
See also: style
public $debug_info

$filename public_oe property

filename:
public $filename

$functions public_oe static_oe property

function:
public static $functions

$indentChar public_oe property

the character used for indenting
See also: indentChars
See also: indentSpaces
public $indentChar

$indentChars public_oe property

allowable characters for indenting
public $indentChars

$indentSpaces public_oe property

number of spaces for indentation. Used to calculate {@link Level} if {@link indentChar} is space.
public $indentSpaces

$instance public_oe static_oe property

Static holder for last instance of a SassParser
public static $instance

$line public_oe property

line:
public $line

$line_numbers public_oe property

line_numbers:
See also: debug_info
See also: style
public $line_numbers

$load_path_functions public_oe property

public $load_path_functions

$load_paths public_oe property

load_paths:
public $load_paths

$property_syntax public_oe property

property_syntax:
public $property_syntax

$quiet public_oe property

quiet:
public $quiet

$source public_oe property

source
public $source

$style public_oe property

style:
public $style

$syntax public_oe property

syntax:
public $syntax