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

render-blocking

它能做什么

这个技能找出阻止页面显示的 CSS 和 JavaScript 文件,并调整它们的加载方式。它面向希望页面更快显示内容的网站构建者。

适用场景

  • ✓你请智能体找出让页面在加载时保持空白的原因的时候。
  • ✓页面在显示任何内容前长时间显示白屏的时候。
  • ✓你在检查页面 head 中脚本和样式表的加载方式的时候。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 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 @import in 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.

repo: thedaviddias/Front-End-Checklist

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能