PHP Class titanscss_server

Author: Leaf Corcoran ([email protected])
Afficher le fichier Open project: gambitph/titan-framework

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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 méthode

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 méthode

Get path to cached .css file
protected cacheName ( $fname ) : string
Résultat string

compile() protected méthode

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

findInput() protected méthode

Get path to requested .scss file
protected findInput ( ) : string
Résultat string

importsCacheName() protected méthode

Get path to cached imports
protected importsCacheName ( $out ) : string
Résultat string

inputName() protected méthode

Get name of requested .scss file
protected inputName ( ) : string | null
Résultat string | null

join() protected méthode

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
Résultat string

needsCompile() protected méthode

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

serve() public méthode

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 méthode

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