css-minification
它能做什么
这项技能检查正式环境中的样式表是否已压缩。适合希望在视觉效果不变的前提下加快页面加载的开发者和网站所有者。
适用场景
- ✓当正式环境的 CSS 文件可读性强、包含大量空白时。
- ✓当你的构建工具没有设置压缩时。
- ✓当你想把压缩与 Gzip 或 Brotli 结合,使文件更小时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/css-minification/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请确保我的正式构建会压缩所有 CSS 文件,并告诉我体积缩小了多少。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在构建工具中设置压缩,使用 cssnano、lightningcss 或框架内置选项等工具,并确认输出文件确实变小了。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Minify all CSS files
Unminified CSS wastes bandwidth with whitespace, comments, and verbose syntax—minification delivers the same styles in significantly fewer bytes.
Quick Reference
- Enable minification in build tool (Vite, webpack, etc.)
- Use cssnano or lightningcss for PostCSS pipelines
- Typical reduction: 20-40% file size savings
- Combine with Gzip/Brotli for maximum compression
Check
Verify that all CSS files are minified in production to reduce file size, eliminate whitespace, and improve page load performance.
Fix
Set up CSS minification in your build process using tools like cssnano, CleanCSS, or built-in framework minification to compress CSS files.
Explain
Explain how CSS minification improves website performance by reducing file sizes, decreasing bandwidth usage, and speeding up page load times.
Code Review
Review stylesheets, component styles, and responsive states related to Minify all CSS files. 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/css-minification
常见问题
CSS 能缩小多少?
这项技能给出的典型范围是 20% 到 40%。
压缩会改变网站的外观吗?
这项技能说明,压缩是用更少的字节传递相同的样式。
还应该使用压缩传输吗?
应该。这项技能建议把压缩与 Gzip 或 Brotli 结合使用。
详情
作者的原始描述
Use when reviewing stylesheets, component styles, and responsive behavior related to Minify all CSS files. Check the rendered layout across breakpoints and interaction states before proposing a fix.
热度
- GitHub 星标
- 75k
- 排名
- #2800
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。