Concrete
GuidesOrganize and ship

Ship a font with the template

Your design uses a licensed or self-hosted typeface, and you need it in the template rather than on a font CDN.

Goal

Put a font file in the workspace, declare it, and reach it from a utility — without a hosted stylesheet, which a rendered format cannot load at all.

Prerequisites

The workspace from Start and the font files themselves, as WOFF2. Styling covers the import graph this rides on; theme tokens covers the token half.

Steps

1. Put the files in the workspace

Anywhere you like — only template.ts is a reserved name, so fonts/ is a convention and nothing more.

Make a fonts/ folder and copy the font files into it, from your file manager or with your shell's own copy command:

fonts/
  canela-regular.woff2
  canela-medium.woff2

Commit them. They are part of the template the same way a section is: the artifact carries the bytes, and a build on another machine produces the same template because the files are in the tree rather than on somebody's CDN.

2. Declare the faces in CSS

A @font-face is ordinary CSS in any stylesheet the graph reaches. The url() is resolved against the file that wrote it and content-hashed into the template's static assets, so a relative path keeps working after the stylesheet is inlined.

globals.css
@import "tailwindcss";
@import "@homepages/concrete/styles.css";

@font-face {
  font-family: "Canela";
  src: url("./fonts/canela-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Canela";
  src: url("./fonts/canela-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

One @font-face per file, per weight and per style. A single face claiming four weights is how a page ends up synthesising bold from a regular cut.

3. Give it a token, so sections ask for it by role

globals.css
@theme {
  --font-heading: "Canela", Georgia, serif;
}

Sections then write font-heading and never name the family. Changing the typeface later is one line here rather than a sweep through the markup.

Name the token for the role, not for the descriptor above it: the font-display inside a @font-face is CSS's own property for what the browser paints while the file loads, and a --font-display token would compile a utility with the same spelling and a completely different meaning.

4. Never reach for a hosted stylesheet

A hosted @import is the one thing this recipe exists to avoid:

globals.css
/* Don't: a rendered format's capture cannot fetch this, and the artifact is
   no longer self-contained. */
@import url("https://fonts.googleapis.com/css2?family=Canela");

A deck, a social post or a print sheet is captured by a download worker whose page reaches nothing but its own bundle, so its compiled stylesheet may reference no external URL at all — css/external-url, graded over the compiled output rather than over what you wrote. A website is not refused there, but it still pays a third-party round trip on every visit and renders in a fallback face until it lands.

Verify

Run concrete dev and look at the heading in the playground: the wrong face usually means the src: path did not resolve from the file that wrote it, and a missing token shows up as the fallback family instead. Then run concrete check — the stylesheet stage compiles the graph and grades the compiled CSS, which is where an external URL and an unresolvable url() (css/compile-failed) are both reported.

On this page