class ViteFonts

Properties

static protected array $manifests

The cached font manifests.

Methods

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

Read the font manifest for the given configuration.

array|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.

static void
flush()

Flush cached manifests.

Details

at line 23
array|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|null

Exceptions

ViteException

at line 39
protected array|null readManifest(string $path)

Read and decode a manifest file.

Parameters

string $path

Return Value

array|null

Exceptions

ViteException

at line 76
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

at line 97
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

at line 135
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

at line 157
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

at line 181
void ensureValidManifest(array $manifest)

Validate the font manifest structure.

Parameters

array $manifest

Return Value

void

Exceptions

ViteException

at line 204
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

at line 224
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

at line 242
static void flush()

Flush cached manifests.

Return Value

void