render-blocking
它能做什么
这个技能找出阻止页面显示的 CSS 和 JavaScript 文件,并调整它们的加载方式。它面向希望页面更快显示内容的网站构建者。
适用场景
- ✓你请智能体找出让页面在加载时保持空白的原因的时候。
- ✓页面在显示任何内容前长时间显示白屏的时候。
- ✓你在检查页面 head 中脚本和样式表的加载方式的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/render-blocking/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的页面在显示任何内容之前会空白一段时间。请帮我找出阻塞它的文件,并修改它们的加载方式吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查页面开头加载的 CSS 和 JavaScript,找出阻止首次绘制的文件。然后在安全的情况下添加 defer 或 async,移动非关键样式,或将关键 CSS 内联。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Eliminate render-blocking resources
Render-blocking resources prevent the browser from painting anything on the screen, leading to a "white screen" effect and poor user experience.
Quick Reference
- Load non-critical CSS and JS asynchronously using
defer,async, or media queries - Inline critical CSS to allow the page to start rendering immediately
- Avoid
@importin CSS as it creates serial request chains
Check
Review the page's resources and identify any CSS or JavaScript files that are blocking the initial render of the page.
Fix
Update the loading strategy for render-blocking resources by using defer, async, or inlining critical styles.
Explain
Explain how render-blocking resources impact the First Contentful Paint (FCP) and how to resolve them.
Code Review
Review the routes, assets, and loading behavior that affect Eliminate render-blocking resources. 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/render-blocking
常见问题
defer 和 async 有什么区别?
这个技能提到,两者都能在不阻塞页面的情况下加载脚本,具体选哪一个取决于脚本的用途。
为什么要避免 CSS 中的 import 规则?
这个技能说,它会形成一个接一个加载的请求链。
这会对页面产生什么影响?
它会改善 First Contentful Paint,即屏幕上首次出现内容的时间。
详情
作者的原始描述
Use when auditing slow page loads, heavy assets, or rendering delays related to Eliminate render-blocking resources. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.
热度
- GitHub 星标
- 75k
- 排名
- #2994
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。