[]previous and next page

SubsetFontsOptions

Options of subsetFonts.

Options of subsetFonts.

Import#

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

Signature#

ts
interface SubsetFontsOptions {
  /** The `public/` folder the font files are read from and the slices are written to. */
  readonly publicDir: string;
  /**
   * The slices to make: names from {@link FONT_SUBSETS}, or your own `{ name, unicodeRange }`. Default `["latin", "latin-ext"]`.
   */
  readonly subsets?: readonly (string | FontSubset)[];
  /** Names of the slices a page preloads. Default: the first slice. A slice that is not preloaded is fetched when its characters are used. */
  readonly preload?: readonly string[];
  /** The folder of the slices under `publicDir`. Default `fonts/subset`. */
  readonly directory?: string;
  /** Where finished slices are kept between builds. Default: `node_modules/.cache/dusk/font-subsets` under `root`. */
  readonly cacheDir?: string;
  /** The project root, for the default cache folder. Default `process.cwd()`. */
  readonly root?: string;
  /** The cutting function, or the name of the module to import it from. Default `"subset-font"`, an optional peer. */
  readonly subsetFont?: string | SubsetFontFn;
}

Members#

Name Type Description
publicDir readonly publicDir: string The public/ folder the font files are read from and the slices are written to.
subsets? readonly subsets?: readonly (string | FontSubset)[] The slices to make: names from FONT_SUBSETS, or your own { name, unicodeRange }. Default ["latin", "latin-ext"].
preload? readonly preload?: readonly string[] Names of the slices a page preloads. Default: the first slice. A slice that is not preloaded is fetched when its characters are used.
directory? readonly directory?: string The folder of the slices under publicDir. Default fonts/subset.
cacheDir? readonly cacheDir?: string Where finished slices are kept between builds. Default: node_modules/.cache/dusk/font-subsets under root.
root? readonly root?: string The project root, for the default cache folder. Default process.cwd().
subsetFont? readonly subsetFont?: string | SubsetFontFn The cutting function, or the name of the module to import it from. Default "subset-font", an optional peer.