class ViteFonts (View source)

Properties

static protected array<string, array<string, mixed>> $manifests

The cached font manifests.

Methods

array<string, mixed>|null
manifest(bool $isHot, string $buildDirectory, string $manifestFilename, string $hotFile)

Read the font manifest for the given configuration.

array<string, mixed>|null
readManifest(string $path)

Read and decode a manifest file.

string
resolveStyleContent(array $manifest, array|null $aliases, string $buildDirectory)

Resolve the CSS content from the manifest.

string
resolveFilteredStyleContent(array $style, array $aliases)

Resolve filtered CSS content using per-alias fragments from the manifest.

string
filterVariables(array $variables, array $aliases)

Build a :root block containing only the CSS variables for the given aliases.

string
readStyleFile(string $buildDirectory, string $file)

Read a CSS file from the build directory.

void
ensureValidManifest(array $manifest)

Validate the font manifest structure.

void
ensureValidFamilies(array $aliases, array $manifest)

Validate that the requested aliases exist in the manifest.

void
ensureValidPreloads(array $preloads, bool $isHot)

Validate that each preload entry contains the required keys.

void
flush()

Flush cached manifests.

Details

array<string, mixed>|null manifest(bool $isHot, string $buildDirectory, string $manifestFilename, string $hotFile)

Read the font manifest for the given configuration.

Parameters

bool $isHot
string $buildDirectory
string $manifestFilename
string $hotFile

Return Value

array<string, mixed>|null

Exceptions

ViteException

protected array<string, mixed>|null readManifest(string $path)

Read and decode a manifest file.

Parameters

string $path

Return Value

array<string, mixed>|null

Exceptions

ViteException

string resolveStyleContent(array $manifest, array|null $aliases, string $buildDirectory)

Resolve the CSS content from the manifest.

Parameters

array $manifest
array|null $aliases
string $buildDirectory

Return Value

string

Exceptions

ViteException

protected string resolveFilteredStyleContent(array $style, array $aliases)

Resolve filtered CSS content using per-alias fragments from the manifest.

Parameters

array $style
array $aliases

Return Value

string

Exceptions

ViteException

protected string filterVariables(array $variables, array $aliases)

Build a :root block containing only the CSS variables for the given aliases.

Parameters

array $variables
array $aliases

List of aliases in desired emission order.

Return Value

string

protected string readStyleFile(string $buildDirectory, string $file)

Read a CSS file from the build directory.

Parameters

string $buildDirectory
string $file

Return Value

string

Exceptions

ViteException

void ensureValidManifest(array $manifest)

Validate the font manifest structure.

Parameters

array $manifest

Return Value

void

Exceptions

ViteException

void ensureValidFamilies(array $aliases, array $manifest)

Validate that the requested aliases exist in the manifest.

Parameters

array $aliases
array $manifest

Return Value

void

Exceptions

ViteException

void ensureValidPreloads(array $preloads, bool $isHot)

Validate that each preload entry contains the required keys.

Parameters

array $preloads
bool $isHot

Return Value

void

Exceptions

ViteException

void flush()

Flush cached manifests.

Return Value

void

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.