font-loading
它能做什么
这项技能检查网站如何加载自定义字体。适用于希望文字快速出现并保持位置不变的开发者。
适用场景
- ✓当自定义字体加载时,文字有一段时间不可见的时候。
- ✓当字体最终出现时,页面布局发生跳动的时候。
- ✓当你的页面在 Core Web Vitals 上得分较低的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/font-loading/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“为什么页面加载时我的文字会有一秒钟看不见?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查 font-display 设置,以及关键字体是否已预加载。它会建议使用 font-display swap,并对最重要的字体文件进行预加载。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Optimize web font loading
Slow font loading can cause 'Flash of Invisible Text' (FOIT) or significant layout shifts, negatively impacting both user experience and Core Web Vitals.
Quick Reference
- Use
font-display: swapto prevent invisible text during load - Preload critical fonts to discover them earlier
- Use modern formats like WOFF2 for better compression
Check
Check font loading strategies and verify that font-display is used and critical fonts are preloaded.
Fix
Add font-display: swap to @font-face declarations and use <link rel='preload'> for the most important fonts.
Explain
Explain how font loading affects perceived performance and layout stability.
Code Review
Review the routes, assets, and loading behavior that affect Optimize web font loading. Flag exact files, requests, or rendering steps that add unnecessary network, CPU, or layout cost, and describe the measurement method used to confirm the issue.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/font-loading
常见问题
什么是不可见文字闪烁(Flash of Invisible Text)?
它指网页字体下载时文字保持隐藏的情况,这项技能旨在防止这种情况发生。
font-display swap 有什么作用?
它会先用备用字体显示文字,待自定义字体加载完成后再切换。
它建议哪种字体格式?
这项技能建议使用 WOFF2,以获得更好的压缩效果。
详情
作者的原始描述
Use when auditing slow page loads, heavy assets, or rendering delays related to Optimize web font loading. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.
热度
- GitHub 星标
- 75k
- 排名
- #2853
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。