Asset Helpers

Asset helpers are specialized template tags made for bundling and caching styles and scripts.

Link

Initialize the collection:

Tag::link()->init(string $name);

Append a link to the collection:

Tag::link()->append(string|array $attribute, string $value);
Tag::link()->appendFile(string|array $file);

Prepend a link to the collection:

Tag::link()->prepend(string|array $attribute, string $value);
Tag::link()->prependFile(string|array $file);

Remove a link from the collection:

Tag::link()->remove(string $attribute, string $value);
Tag::link()->removeFile(string|array $file);

Rewrite paths in the collection:

Tag::link()->rewrite(array rewriteArray);

Concat the collection to a cached file:

Tag::link()->concat(array $optionArray);

Clear the collection:

Tag::link()->clear();

Style

Initialize the collection:

Tag::style()->init(string $name);

Append inline style to the collection:

Tag::style()->appendInline(string $inline);

Prepend inline style to the collection:

Tag::style()->prependInline(string $inline);

Clear the collection:

Tag::link()->clear();

Script

Initialize the collection:

Tag::script()->init(string $name);

Append a script to the collection:

Tag::script()->append(string|array $attribute, string $value);
Tag::script()->appendFile(string|array $file);

Append inline script to the collection:

Tag::script()->appendInline(string $inline);

Prepend a script to the collection:

Tag::script()->prepend(string|array $attribute, string $value);
Tag::script()->prependFile(string|array $file);

Prepend inline script to the collection:

Tag::script()->prependInline(string $inline);

Remove a script from the collection:

Tag::script()->remove(string $attribute, string $value);
Tag::script()->removeFile(string|array $file);

Transport PHP to JavaScript variables:

Tag::script()->transportVar(string $key, string|array $value);

Concat the collection to a cached file:

Tag::script()->concat(array $optionArray);

Clear the collection:

Tag::script()->clear();
Edit on GitHub