How to Change the Font in Your Weaverse Theme
Weaverse themes use modern font loading techniques for performance and flexibility. The default Pilot theme uses Fontsource for Google Fonts, but you can use any web font provider or upload custom fonts. This guide covers all approaches with practical examples.Pilot uses Tailwind CSS v4, which is configured CSS-first through the
@theme directive. There is no tailwind.config.js file — the Tailwind plugin is registered in vite.config.ts and all design tokens live in app/styles/theme.css.1. Using Fontsource (Recommended)
Fontsource provides npm packages for hundreds of Google Fonts and more, including support for variable fonts.a. Install the Fontsource Package
Pilot ships with two variable fonts:b. Import Font Files in root.tsx
Pilot imports its fonts at the very top ofapp/root.tsx:
c. Update the @theme Font Variables
Tailwind v4 derives font-sans, font-serif, and font-mono utilities from CSS variables. Pilot declares them at the top of app/styles/theme.css:
font-family name published by the font provider (Fontsource variable packages append Variable to the family name) or the name in your own @font-face declaration.
app/styles/theme.css is pulled in by app/styles/app.css, which is where Tailwind itself is imported:
d. Set a Base Font in Global CSS (if needed)
Utilities such asfont-sans already resolve to your @theme value, so this is only needed if you want a default outside of Tailwind utilities:
2. Using Google Fonts CDN
For a quick setup, add a<link> to the document head in app/root.tsx (or through the links export):
app/styles/theme.css:
CSP Reminder: If you load fonts from an external CDN (such as Google Fonts), make sure to update your Content Security Policy (CSP) to allow the font and stylesheet sources. See the CSP guide for details and examples.
3. Uploading a Custom Font
a. Add Font Files to the Public Folder
Place.woff2, .woff, or .ttf files in public/fonts/.
b. Declare @font-face in CSS
c. Register It in @theme
4. Switching Fonts Dynamically (Optional)
To let merchants select fonts in Weaverse Studio:- Add a font selector input in your theme schema (see
app/weaverse/schema.server.ts). - Use the selected value to set the font-family dynamically in your global style component, which writes CSS custom properties into the document.
5. Best Practices
- Only load the weights/styles you use.
- Use
font-display: swapfor performance. - Prefer
.woff2for custom fonts. - Test on all devices and browsers.
- Respect font licensing for custom fonts.