[]previous and next page

FontsOutput

What defineFonts produces.

What defineFonts produces.

Import#

ts
import type { FontsOutput } from "@shadow-js/dusk/vite";

Signature#

ts
interface FontsOutput {
  /** The stylesheet text: every `@font-face` and one `:root` block with the variables. */
  readonly css: string;
  /** Head tags that preload the files that are preloaded (see {@link FontFile.preload}). */
  readonly preloads: readonly HeadTag[];
  /** Head tags that open the connection to the CDN (`assetOrigin`); empty without one. Put them before `preloads`. */
  readonly preconnects: readonly HeadTag[];
  /** Variable name to font stack, as written in the `:root` block. */
  readonly variables: Readonly<Record<string, string>>;
  /** URL paths of every file, in the order they are declared. */
  readonly urls: readonly string[];
  /**
   * The class names of each family, by the family's key in the input (`google:Inter` for a Google family). Apply
   * `className` to an element for the family's font; `variableClass` to set the family's variable on that element.
   */
  readonly classes: Readonly<Record<string, FontClasses>>;
  /** Preload tags for some routes only (`DefineFontsOptions.routes`); empty without it. Read them with `fontPreloadsFor`. */
  readonly routePreloads: readonly FontRoutePreloads[];
  /** Every font file with its size, and the bytes that every page preloads (see `formatFontReport`). */
  readonly report: FontReport;
}

Members#

Name Type Description
css readonly css: string The stylesheet text: every @font-face and one :root block with the variables.
preloads readonly preloads: readonly HeadTag[] Head tags that preload the files that are preloaded (see FontFile.preload).
preconnects readonly preconnects: readonly HeadTag[] Head tags that open the connection to the CDN (assetOrigin); empty without one. Put them before preloads.
variables readonly variables: Readonly<Record<string, string>> Variable name to font stack, as written in the :root block.
urls readonly urls: readonly string[] URL paths of every file, in the order they are declared.
classes readonly classes: Readonly<Record<string, FontClasses>> The class names of each family, by the family's key in the input (google:Inter for a Google family). Apply className to an element for the family's font; variableClass to set the family's variable on that element.
routePreloads readonly routePreloads: readonly FontRoutePreloads[] Preload tags for some routes only (DefineFontsOptions.routes); empty without it. Read them with fontPreloadsFor.
report readonly report: FontReport Every font file with its size, and the bytes that every page preloads (see formatFontReport).