AssetUtilsTrait
Trait AssetUtilsTrait
Table of Contents
Properties
- $base_url : string
- $fetch_command : Closure|null
Methods
- isRemoteLink() : bool
- Determine whether a link is local or remote.
- gatherLinks() : string
- Download and concatenate the content of several links.
- moveImports() : string
- Moves @import statements to the top of the file per the CSS specification
- renderAttributes() : string
- Build an HTML attribute string from an array.
- renderQueryString() : string
- Render Querystring
Properties
$base_url
protected
string
$base_url
$fetch_command
protected
Closure|null
$fetch_command
Closure used by the pipeline to fetch assets.
Useful when file_get_contents() function is not available in your PHP installation or when you want to apply any kind of preprocessing to your assets before they get pipelined.
The closure will receive as the only parameter a string with the path/URL of the asset and it should return the content of the asset file as a string.
Methods
isRemoteLink()
Determine whether a link is local or remote.
public
static isRemoteLink(string $link) : bool
Understands both "http://" and "https://" as well as protocol agnostic links "//"
Parameters
- $link : string
Return values
boolgatherLinks()
Download and concatenate the content of several links.
protected
gatherLinks(array<string|int, mixed> $assets[, int $type = self::CSS_ASSET ]) : string
Parameters
- $assets : array<string|int, mixed>
- $type : int = self::CSS_ASSET
Return values
stringmoveImports()
Moves @import statements to the top of the file per the CSS specification
protected
moveImports(string $file) : string
Parameters
- $file : string
-
the file containing the combined CSS files
Return values
string —the modified file with any @imports at the top of the file
renderAttributes()
Build an HTML attribute string from an array.
protected
renderAttributes() : string
Return values
stringrenderQueryString()
Render Querystring
protected
renderQueryString([string|null $asset = null ]) : string
Parameters
- $asset : string|null = null