Documentation

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

$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

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
bool

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
string

moveImports()

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
string

renderQueryString()

Render Querystring

protected renderQueryString([string|null $asset = null ]) : string
Parameters
$asset : string|null = null
Return values
string

        
On this page

Search results