跳到正文
Skillpedia
网站与界面(前端)75k · #2853

font-loading

它能做什么

这项技能检查网站如何加载自定义字体。适用于希望文字快速出现并保持位置不变的开发者。

适用场景

  • ✓当自定义字体加载时,文字有一段时间不可见的时候。
  • ✓当字体最终出现时,页面布局发生跳动的时候。
  • ✓当你的页面在 Core Web Vitals 上得分较低的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/font-loading/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/font-loading/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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: swap to 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.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2853
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能