class Frontend implements ExtenderInterface

Methods

__construct(string $frontend)

No description

css(string $path)

Add a CSS file to load in the frontend.

js(string $path)

Add a JavaScript file to load in the frontend.

jsDirectory(string $path)

Add a directory of JavaScript files to include in the JS assets public directory.

route(string $path, string $name, callable|string|null $content = null)

Add a route to the frontend.

removeRoute(string $name)

Remove a route from the frontend.

content(callable|string|null $callback, int $priority = 0)

Modify the content of the frontend.

preloads(callable|array $preloads)

Adds multiple asset preloads.

title(string $driverClass)

Register a new title driver to change the title of frontend documents.

extraDocumentAttributes(array $attributes)

Adds document root attributes.

extraDocumentClasses(string|array|callable $classes)

Adds document root classes.

void
extend(Container $container, Extension|null $extension = null)

No description

Details

__construct(string $frontend)

Parameters

string $frontend

Frontend css(string $path)

Add a CSS file to load in the frontend.

Parameters

string $path

Return Value

Frontend

Frontend js(string $path)

Add a JavaScript file to load in the frontend.

Parameters

string $path

Return Value

Frontend

Frontend jsDirectory(string $path)

Add a directory of JavaScript files to include in the JS assets public directory.

Primarily used to copy JS chunks.

Parameters

string $path The path to the specific frontend chunks directory.

Return Value

Frontend

Frontend route(string $path, string $name, callable|string|null $content = null)

Add a route to the frontend.

Parameters

string $path
string $name
callable|string|null $content

Return Value

Frontend

Frontend removeRoute(string $name)

Remove a route from the frontend.

This is necessary before overriding a route.

Parameters

string $name

Return Value

Frontend

Frontend content(callable|string|null $callback, int $priority = 0)

Modify the content of the frontend.

Parameters

callable|string|null $callback
int $priority

Return Value

Frontend

Frontend preloads(callable|array $preloads)

Adds multiple asset preloads.

The parameter should be an array of preload arrays, or a callable that returns this. A preload array must contain keys that pertain to the `<link rel="preload">` tag. For example, the following will add preload tags for a script and font file: ``` $frontend->preloads([ [ 'href' => '/assets/my-script.js', 'as' => 'script', ], [ 'href' => '/assets/fonts/my-font.woff2', 'as' => 'font', 'type' => 'font/woff2', 'crossorigin' => '' ] ]); ```

Parameters

callable|array $preloads

Return Value

Frontend

Frontend title(string $driverClass)

Register a new title driver to change the title of frontend documents.

Parameters

string $driverClass

Return Value

Frontend

Frontend extraDocumentAttributes(array $attributes)

Adds document root attributes.

Parameters

array $attributes

Return Value

Frontend

Frontend extraDocumentClasses(string|array|callable $classes)

Adds document root classes.

Can either be a string or an array of strings. An array can be of a format acceptable by the @class blade directive.

Parameters

string|array|callable $classes

Return Value

Frontend

void extend(Container $container, Extension|null $extension = null)

Parameters

Container $container
Extension|null $extension

Return Value

void