self-hosted-fonts-vite

self-hosted-fonts-vite is a cursor rule for coding agents from dmenchaca/webflow-to-react. It costs 0 tokens per session (781 once invoked), scanned A, original, MIT.

A set of rules for loading self-hosted web fonts in Vite and TanStack Start projects. Self-hosted fonts are font files served by the website instead of an external font service.

In plain words
What is it for?
Use it when migrating fonts from Webflow, placing WOFF2 files, writing @font-face rules, and setting multi-word font-family names.
Why use it?
Fonts placed in the wrong directory, referenced with incorrect URLs, or loaded in the wrong order can silently fall back to a different font.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/dmenchaca/webflow-to-react/self-hosted-fonts-vite
Clone the repo
git clone --depth 1 https://github.com/dmenchaca/webflow-to-react

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for self-hosted-fonts-vite

README.md
[![agentmods](https://agentmods.dev/badge/rules/dmenchaca/webflow-to-react/self-hosted-fonts-vite.svg)](https://agentmods.dev/rules/dmenchaca/webflow-to-react/self-hosted-fonts-vite)
Your own site
<a href="https://agentmods.dev/rules/dmenchaca/webflow-to-react/self-hosted-fonts-vite"><img src="https://agentmods.dev/badge/rules/dmenchaca/webflow-to-react/self-hosted-fonts-vite.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 781 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00781
Opus 5 $0.00000 $0.00391
Sonnet 5 $0.00000 $0.00156
Haiku 4.5 $0.00000 $0.00078

Measured 4d ago against content hash 1bc1da8d4e96, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

self-hosted-fonts-vite scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/self-hosted-fonts-vite.mdc · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Self-hosted fonts (Vite / TanStack Start)

Fonts from a Webflow export are the single most common silent-failure point in this migration.

Rules

1. Fonts MUST live in web/public/fonts/

Vite's dev server refuses to serve files outside its root. If .woff2 files live anywhere else (e.g. <repo-root>/fonts/), the dev server returns 404 and the browser silently falls back to Arial. You only notice because the design looks "off."

2. Use root-relative URLs

/* YES */
src: url("/fonts/Inter_18pt-Regular.woff2") format("woff2");

/* NO */
src: url("../../fonts/Inter_18pt-Regular.woff2") format("woff2");

3. @font-face must be imported FIRST

In marketing.css:

@import "./site-fonts.css";             /* ← must be first */
@import "./marketing/normalize.css";
@import "./marketing/layout-components.css";
/* ... */

If body { font-family: "Foo" } is parsed before the matching @font-face rule, some browsers register it against a non-existent family and never retry.

4. Quote multi-word family names everywhere

/* YES */
font-family: "Plus Jakarta Sans", sans-serif;

/* NO — parser reads three families: Plus, Jakarta, Sans */
font-family: Plus Jakarta Sans, sans-serif;

5. Keep Webflow's quirky family names

Webflow exports often reference "Inter 18 Pt" or Plusjakartasans. The compiled CSS already uses those strings. Keep them — aliasing causes more bugs than it fixes.

6. One file, multiple weights when needed

If the export only ships PlusJakartaSans-ExtraBold.woff2, register it against BOTH 700 and 800 so font-weight: bold AND font-weight: 800 resolve without font synthesis.

7. Never default body to Arial

Some starters do this "for safety." Don't. Inherited text breaks wherever a component doesn't explicitly set a font. Use the brand body font on body with a sensible fallback stack.

8. Copy Webflow’s global font-smoothing into base CSS

css/webflow.css (and often inline <style> in the export index.html) sets on *:

Read the full file on GitHub · 79 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 79 lines · 0 tokens per session scan A 1bc1da8d4e96

Subscribe to this mod's changes

self-hosted-fonts-vite is a cursor rule published in the GitHub repository dmenchaca/webflow-to-react (27 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 781 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.