Use Figtree as the default font in your Rspress website.
- 🚀 Automatic font loading via @fontsource-variable/figtree
- ⚡ Smart preloading to prevent FOUT (Flash of Unstyled Text)
- 🎨 Variable font support for flexible typography
- 📦 Zero configuration required
Figtree is a clean yet friendly geometric sans serif font designed for usage in web and mobile apps. Its versatile nature makes it suitable for both body text and headings, with a variable font that offers flexible weight adjustments.
See Google Fonts - Figtree for more details.
Install the plugin as a dev dependency:
# npm
npm add rspress-plugin-font-figtree -D
# bun
bun add rspress-plugin-font-figtree -D
# pnpm
pnpm add rspress-plugin-font-figtree -D
# yarn
yarn add rspress-plugin-font-figtree -DAdd the plugin to your rspress.config.ts:
import { defineConfig } from "rspress/config";
import { pluginFontFigtree } from "rspress-plugin-font-figtree";
export default defineConfig({
plugins: [pluginFontFigtree()],
});That's it! Figtree will now be used as the default font throughout your Rspress site.
This plugin automatically:
- Loads the Figtree variable font from
@fontsource-variable/figtree - Applies custom CSS styling to set Figtree as the default font family
- Configures font preloading to ensure
.woff2files load immediately, preventing font flickering
- Rspress:
^1.0.0or higher - Node.js:
^18.0.0or higher
If fonts aren't appearing, ensure that:
- The plugin is properly imported and added to the
pluginsarray - Your build completed successfully without errors
- Check browser DevTools Network tab to verify font files are loading
If you see a flash of unstyled text, the preloading configuration may not be working. This is rare but can happen if:
- You're using a custom build configuration that overrides the plugin's settings
- There's a version mismatch with Rspress
To contribute or test locally:
# Clone the repository
git clone https://github.com/maccuaa/rspress-plugin-font-figtree.git
cd rspress-plugin-font-figtree
# Install dependencies
bun install
# Build the plugin
bun run build
# Run in watch mode
bun run dev
# Run linting
bun run lintLooking for other font plugins? Check out:
MIT © Andrew MacCuaig