PHP Класс Leafo\ScssPhp\Server

Автор: Leaf Corcoran ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $dir, string $cacheDir = null, Compiler | null $scss = null ) Constructor
checkedCachedCompile ( string $in, string $out, boolean $force = false ) : string Based on explicit input/output files does a full change check on cache before compiling.
checkedCompile ( string $in, string $out ) : boolean Check if file need compiling
compileFile ( string $in, string $out = null ) : string | boolean Compile .scss file
serve ( string $salt = '' ) Compile requested scss and serve css. Outputs HTTP response.
serveFrom ( string $path ) Helper method to serve compiled scss
showErrorsAsCSS ( boolean $show = true ) Render errors as a pseudo-element within valid CSS, displaying the errors on any page that includes this CSS.

Защищенные методы

Метод Описание
cacheName ( $fname ) : string Get path to cached .css file
compile ( string $in, string $out ) : array Compile .scss file
createErrorCSS ( Exception $error ) : string Format error as a pseudo-element in CSS
findInput ( ) : string Get path to requested .scss file
getIfModifiedSinceHeader ( ) : string | null Get If-Modified-Since header from client request
getIfNoneMatchHeader ( ) : string | null Get If-None-Match header from client request
inputName ( ) : string | null Get name of requested .scss file
join ( string $left, string $right ) : string Join path components
metadataName ( $out ) : string Get path to meta data
needsCompile ( string $out, string &$etag ) : boolean Determine whether .scss file needs to be re-compiled.

Описание методов

__construct() публичный метод

Constructor
public __construct ( string $dir, string $cacheDir = null, Compiler | null $scss = null )
$dir string Root directory to .scss files
$cacheDir string Cache directory
$scss Compiler | null SCSS compiler instance

cacheName() защищенный метод

Get path to cached .css file
protected cacheName ( $fname ) : string
Результат string

checkedCachedCompile() публичный метод

Based on explicit input/output files does a full change check on cache before compiling.
public checkedCachedCompile ( string $in, string $out, boolean $force = false ) : string
$in string
$out string
$force boolean
Результат string Compiled CSS results

checkedCompile() публичный метод

Check if file need compiling
public checkedCompile ( string $in, string $out ) : boolean
$in string Input file (.scss)
$out string Output file (.css)
Результат boolean

compile() защищенный метод

Compile .scss file
protected compile ( string $in, string $out ) : array
$in string Input path (.scss)
$out string Output path (.css)
Результат array

compileFile() публичный метод

Compile .scss file
public compileFile ( string $in, string $out = null ) : string | boolean
$in string Input file (.scss)
$out string Output file (.css) optional
Результат string | boolean

createErrorCSS() защищенный метод

Format error as a pseudo-element in CSS
protected createErrorCSS ( Exception $error ) : string
$error Exception
Результат string

findInput() защищенный метод

Get path to requested .scss file
protected findInput ( ) : string
Результат string

getIfModifiedSinceHeader() защищенный метод

Get If-Modified-Since header from client request
protected getIfModifiedSinceHeader ( ) : string | null
Результат string | null

getIfNoneMatchHeader() защищенный метод

Get If-None-Match header from client request
protected getIfNoneMatchHeader ( ) : string | null
Результат string | null

inputName() защищенный метод

Get name of requested .scss file
protected inputName ( ) : string | null
Результат string | null

join() защищенный метод

Join path components
protected join ( string $left, string $right ) : string
$left string Path component, left of the directory separator
$right string Path component, right of the directory separator
Результат string

metadataName() защищенный метод

Get path to meta data
protected metadataName ( $out ) : string
Результат string

needsCompile() защищенный метод

Determine whether .scss file needs to be re-compiled.
protected needsCompile ( string $out, string &$etag ) : boolean
$out string Output path
$etag string ETag
Результат boolean True if compile required.

serve() публичный метод

Compile requested scss and serve css. Outputs HTTP response.
public serve ( string $salt = '' )
$salt string Prefix a string to the filename for creating the cache name hash

serveFrom() публичный статический метод

Helper method to serve compiled scss
public static serveFrom ( string $path )
$path string Root path

showErrorsAsCSS() публичный метод

Render errors as a pseudo-element within valid CSS, displaying the errors on any page that includes this CSS.
public showErrorsAsCSS ( boolean $show = true )
$show boolean