fontPreloadsFor
The tags to preload on one route: those of every rule whose pattern matches the path, without a tag that preloads (the ones every page loads) already has and without repeats.
The tags to preload on one route: those of every rule whose pattern matches the path, without a tag that preloads
(the ones every page loads) already has and without repeats.
Import#
ts
import { fontPreloadsFor } from "@shadow-js/dusk/vite";
Signature#
ts
function fontPreloadsFor(
rules: readonly FontRoutePreloads[],
pathname: string,
global: readonly HeadTag[] = [],
): readonly HeadTag[]
Parameters#
| Name | Description |
|---|---|
rules |
The route rules of defineFonts' output. |
pathname |
The path of the page (/blog/post), without the query. |
global |
The tags every page already preloads. |
Returns#
The extra tags for this route, in the order of the rules.
Examples#
ts
fontPreloadsFor(fonts.routePreloads, "/blog/post", fonts.preloads).map((tag) => tag.props?.href);