Skip to content
HomePagesHomePages template kit

compileFontFacesToCss

Compile a `TokenTheme`'s font entries into the loading CSS its bundle needs: the `@import` for every hosted stylesheet, then one `@font-face` per shipped file.

Compile a TokenTheme’s font entries into the loading CSS its bundle needs: the @import for every hosted stylesheet, then one @font-face per shipped file. Empty string when the theme loads nothing (every token a bare stack).

SEPARATE from {@link compileThemeToCss} because the two outputs go to different places. The token CSS is compiled INSIDE the Tailwind graph, where @theme means something; this block cannot be — an @import does not hoist out of a nested partial and Tailwind drops it silently — so a caller prepends this to the finished bundle, where an @import may legally sit first.

Two dedupes, both load-bearing. Equal hrefs collapse to ONE @import: a template loading four families from a single hosted stylesheet must keep making one request, not four. Identical faces collapse too, because one typeface routinely backs two tokens — two utility names are two tokens even when they share a family.

Deterministic: tokens are visited in sorted order, so the same theme always content-hashes identically.

Import from @homepages/template-kit.

function compileFontFacesToCss(theme: TokenTheme): string
Name Type Required Description
theme TokenTheme required

string