Properties

$preProcess

$preProcess : 

Callback before asset contents are served

Type

$css

$css : 

The CSS & JS assets

Type

$js

$js : 

The CSS & JS assets

Type

$config

$config : 

The configuration

Type

Methods

config()

config(array  $config) 

Set the configuration

Parameters

array $config

Array containg the configuration

getURL()

getURL(string  $path) 

Make URL from path

Parameters

string $path

Relative path

getPath()

getPath(string  $path) 

Make Absolute Path from relative path

Parameters

string $path

Get absolute location to a file. Returns false if path is outside the base directory

css()

css(string  $name = null,   $url = null) 

Add a CSS asset or return the <link> tag

Parameters

string $name

Asset's name. If this is null, <link href='... tag is returned

$url

$url Path to the CSS file

js()

js(string  $name,   $url) 

Add a JS asset or return the <script> tag

Parameters

string $name

Asset's name. If this is null, <script src='... tag is returned

$url

$url Path to the JS file

removeCSS()

removeCSS(string  $name) 

Remove a CSS asset

Parameters

string $name

The name of asset to remove

removeJS()

removeJS(string  $name) 

Remove a JS asset

Parameters

string $name

The name of asset to remove

getLinkTag()

getLinkTag() 

Get the <link href> tag of all assets

getScriptTag()

getScriptTag() 

Get the <script src> tag of all assets

getServeScriptURL()

getServeScriptURL(array  $params = array()) : array

Get the URL to assets serving file

Parameters

array $params

Extra GET parameters in URL

Returns

array —

Assets with url to serve assets file

getServeLinkTag()

getServeLinkTag(array  $params = array()) 

Get the <link src> tag of combined CSS files

Parameters

array $params

Extra GET data to include in URL

getServeScriptTag()

getServeScriptTag(array  $params = array()) 

Get the <script src> tag of combined JS files

Parameters

array $params

Extra GET data to include in URL

getServeURL()

getServeURL(  $type,   $params = array(),   $customAssets = array()) 

Get the URL to the file that serves the assets

Parameters

$type

string - Either "js" or "css"

$params

array - List of extra GET parameters to include in URL

$customAssets

array - Only include some assets

preProcess()

preProcess(string  $data, string  $type) 

Pre process the code inside asset

Parameters

string $data

Code inside asset

string $type

The asset type (js/css)

serve()

serve() 

Handle the request to serve assets and respond with assets

issetJS()

issetJS(string  $asset) 

Whether a JS asset is added

Parameters

string $asset

Name of asset to check

issetCSS()

issetCSS(string  $asset) : boolean

Whether a CSS asset is added

Parameters

string $asset

Name of asset to check

Returns

boolean

getJS()

getJS(string  $asset = null) : string|array

Get the path to a JS asset or return all JS assets

Parameters

string $asset

Name of asset to check.

Returns

string|array —

Path to asset if $asset is mentioned or all JS assets

getCSS()

getCSS(string  $asset = null) : string|array

Get the path to a CSS asset or return all CSS assets

Parameters

string $asset

Name of asset to check.

Returns

string|array —

Path to asset if $asset is mentioned or all CSS assets

startsWith()

startsWith(string  $string, string  $needle) 

Whether a string starts with a particular string

Parameters

string $string

The string where the check should be done

string $needle

The string to match