TypeSnap
Why TypeSnap
Fonts are the single most common source of layout shift. We solve this at the source.
1. Preload Tags
TypeSnap generates <link rel="preload"> tags in your head, ensuring fonts fetch with priority.
2. font-display: swap
We inject font-display: swap rules to ensure text remains visible during font loading.
3. Metric Matching
Our engine generates size-adjusted fallback stacks that mirror your primary font's metrics, eliminating CLS.
Quick Start
Walkthrough
Run npx typesnap generate to detect all fonts across your project.
- Detect all fonts across CSS, HTML, JS, and Tailwind.
- Write
typesnap-fallbacks.csswith metric overrides. - Write
typesnap-preloads.htmlwith preload tags.
Integration
Agents
Copy this prompt and paste it into your AI assistant (Cursor, Claude, GPT) to correctly integrate TypeSnap into any project.
How It Works
Detection
| File type | What it looks for |
|---|---|
| .css, .scss, .pcss | @import URL, @font-face blocks, and display params. |
| .html, .vue, .astro | Stylesheet links, preloads, and embedded styles. |
| .js, .ts, .tsx | next/font imports and URL literals. |
Generation
CLI Reference
typesnap scanAudit fonts and print a report.
typesnap generateWrite fallback CSS and preloads to disk.
typesnap inject [files...]Inject preloads directly into HTML files.
typesnap lintExit non-zero when font issues exceed a threshold.
Build Plugins
Vite
Next.js
Roadmap
• Vite & Next.js build plugins (Shipped).
• Astro, SvelteKit, Nuxt adapters.
• Cloud-based metric analysis engine.
• VS Code extension for inline warnings.
License
MIT © Om Rajguru. TypeSnap is an original concept by Om Rajguru, April 2026.