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

unused-css

Skill này làm gì

Skill này tìm các quy tắc CSS mà website không bao giờ dùng và xóa chúng an toàn. Nó dành cho lập trình viên có website tải nhiều kiểu dáng hơn mức cần thiết.

Khi nào nên dùng

  • ✓Khi website dùng một framework CSS lớn nhưng chỉ sử dụng một phần nhỏ.
  • ✓Khi quy trình build có thể tự động loại bỏ các bộ chọn không dùng.
  • ✓Khi kiểm tra hiệu năng cho thấy stylesheet quá nặng.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/unused-css/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/unused-css/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

“Website của tôi tải một file CSS rất lớn nhưng chỉ dùng vài kiểu dáng. Bạn có thể tìm phần không dùng và cắt giảm nó không?”

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

Cách hoạt động

Agent dùng công cụ coverage hoặc công cụ purge để tìm các bộ chọn không trang nào dùng. Sau đó nó xóa chúng, nhưng giữ lại các class động mà script thêm vào sau này.

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.

Remove unused CSS rules

Most projects use only 10-25% of their CSS—removing the rest can cut bundle sizes by 75%+ and dramatically improve load times.

Quick Reference

  • Use PurgeCSS or UnCSS to remove unused selectors
  • Integrate into build pipeline (Webpack, Vite, PostCSS)
  • Safelist dynamic classes and framework-specific patterns
  • Typical reduction: 50-90% for CSS framework users

Check

Use tools like PurgeCSS, UnCSS, or Chrome DevTools Coverage to identify and remove unused CSS to reduce bundle size and improve performance.

Fix

Implement automated unused CSS removal in your build process and regularly audit CSS files to eliminate dead code and unused selectors.

Explain

Explain how unused CSS bloats bundle sizes, slows page loading, and how modern tools can safely remove unused styles without breaking functionality.

Code Review

Review stylesheets, component styles, and responsive states related to Remove unused CSS rules. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


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

Rule page: https://frontendchecklist.io/rules/css/unused-css

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

Xóa CSS có làm vỡ bố cục không?

Skill khuyến nghị kiểm tra bố cục đã render ở nhiều kích thước màn hình và trạng thái tương tác, và đưa các class động vào safelist.

Có thể xóa được bao nhiêu CSS?

Skill dẫn các mức giảm điển hình từ 50 đến 90 phần trăm đối với người dùng framework CSS.

Nó nhắc tới công cụ nào?

PurgeCSS, UnCSS và bảng Coverage trong Chrome DevTools.

Chi tiết

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

Use when reviewing stylesheets, component styles, and responsive behavior related to Remove unused CSS rules. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#3071
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ự