Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #2871

html-resource-hints

Skill này làm gì

Skill này kiểm tra một trang để tìm các tệp quan trọng mà trình duyệt phát hiện quá muộn. Skill dành cho lập trình viên muốn lần xem đầu tiên của trang web nhanh hơn.

Khi nào nên dùng

  • ✓Khi một phông chữ web chỉ được phát hiện sau khi trình duyệt đọc xong stylesheet.
  • ✓Khi ảnh chính hoặc một script quan trọng tải muộn hơn mức cần thiết.
  • ✓Khi trang của bạn dùng nhiều dịch vụ bên thứ ba cần kết nối sớm.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/html-resource-hints/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/html-resource-hints/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể thêm preload hint để phông chữ chính và ảnh chính tải sớm hơn không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tìm các tài nguyên quan trọng tải muộn và gợi ý preload cho chúng. Agent cũng gợi ý preconnect cho các tên miền bên thứ ba được dùng sớm trên trang.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Add resource hints (preload, prefetch, dns-prefetch)

The browser's HTML parser discovers resources sequentially — a font referenced in a CSS file won't be fetched until the CSS is parsed. Resource hints break this dependency chain, allowing the browser to start fetching critical resources in parallel with parsing. A single preload directive for a critical font can eliminate a 100–300ms Flash of Invisible Text.

Quick Reference

  • preload forces immediate download of resources needed by the current page
  • prefetch fetches resources likely needed for the next navigation (low priority)
  • dns-prefetch resolves DNS for third-party origins in advance
  • preconnect does DNS + TCP + TLS for origins you'll connect to soon

Check

Look at this HTML file for late-discovered critical resources — fonts referenced in CSS, hero images, and key scripts. Identify where preload or preconnect hints would help.

Fix

Add appropriate preload hints for critical fonts, images, and scripts. Add preconnect for third-party domains used early in the page.

Explain

Explain each resource hint type (preload, prefetch, preconnect, dns-prefetch), when to use each, and the consequences of misusing them.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Add resource hints (preload, prefetch, dns-prefetch). Flag exact elements, attributes, and routes where the rendered HTML violates the rule.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/en/rules/html/html-resource-hints

Câu hỏi thường gặp

Preload khác prefetch như thế nào?

Preload tải những gì trang hiện tại cần ngay. Prefetch tải những gì trang tiếp theo có thể cần, với độ ưu tiên thấp.

preconnect làm gì?

Nó mở kết nối tới một máy chủ từ sớm, gồm DNS, TCP và TLS, nhờ đó các yêu cầu sau này bắt đầu nhanh hơn.

dns-prefetch là gì?

Nó phân giải trước tên miền bên thứ ba. Đây là lựa chọn nhẹ hơn preconnect.

Chi tiết

Mô tả gốc của tác giả

Use when reviewing templates, rendered HTML, or shared components related to Add resource hints (preload, prefetch, dns-prefetch). Validate the final browser-facing markup, not just the source framework abstraction.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2871
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự