PHP Class titanscss_server

Author: Leaf Corcoran ([email protected])
Mostra file Open project: gambitph/titan-framework

Public Methods

Method Description
__construct ( string $dir, string $cacheDir = null, scssc | null $scss = null ) Constructor
serve ( string $salt = '' ) Compile requested scss and serve css. Outputs HTTP response.
serveFrom ( string $path ) Helper method to serve compiled scss

Protected Methods

Method Description
cacheName ( $fname ) : string Get path to cached .css file
compile ( string $in, string $out ) : string Compile .scss file
findInput ( ) : string Get path to requested .scss file
importsCacheName ( $out ) : string Get path to cached imports
inputName ( ) : string | null Get name of requested .scss file
join ( string $left, string $right ) : string Join path components
needsCompile ( string $in, string $out ) : boolean Determine whether .scss file needs to be re-compiled.

Method Details

__construct() public method

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

cacheName() protected method

Get path to cached .css file
protected cacheName ( $fname ) : string
return string

compile() protected method

Compile .scss file
protected compile ( string $in, string $out ) : string
$in string Input path (.scss)
$out string Output path (.css)
return string

findInput() protected method

Get path to requested .scss file
protected findInput ( ) : string
return string

importsCacheName() protected method

Get path to cached imports
protected importsCacheName ( $out ) : string
return string

inputName() protected method

Get name of requested .scss file
protected inputName ( ) : string | null
return string | null

join() protected method

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
return string

needsCompile() protected method

Determine whether .scss file needs to be re-compiled.
protected needsCompile ( string $in, string $out ) : boolean
$in string Input path
$out string Output path
return boolean True if compile required.

serve() public method

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() public static method

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