跳到正文
Skillpedia
图片与图标75k · #3033

sprite-generation

它能做什么

这个技能检查网站上的小图片和图标,并建议将它们合并为精灵图,或改用 SVG 图标。它面向希望减少小图形请求次数的网站构建者。

适用场景

  • ✓你请智能体减少页面上小图片请求数量的时候。
  • ✓页面需要逐个加载几十个小图标文件的时候。
  • ✓你在为网站在精灵图、SVG 图标和图标字体之间做选择的时候。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“我的页面加载了几十个很小的图标文件。请帮我把它们合并,或改用 SVG,让页面的请求更少吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会找出网站中使用的小图片和图标。它会建议构建一个将它们合并在一起的 CSS 精灵图,或改用内联 SVG 或 SVG 图标系统;该技能指出,后者通常更灵活。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Use image sprites where appropriate

Each image is an HTTP request—combining many small images into one sprite reduces requests, though modern HTTP/2 and SVG icons have reduced this need.

Quick Reference

  • Sprites combine multiple images into one to reduce HTTP requests
  • Modern alternative: SVG icon systems (more flexible)
  • HTTP/2 makes sprites less critical but still useful for small icons
  • Consider inline SVG or icon fonts for most icon use cases

Check

Check if small images and icons are combined into sprites to reduce HTTP requests.

Fix

Create CSS sprites for icons and small images, or migrate to SVG icons.

Explain

Explain how sprites reduce HTTP requests but consider modern alternatives like SVG icons.

Code Review

Review image assets, markup, and delivery configuration related to Use image sprites where appropriate. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.


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

Rule page: https://frontendchecklist.io/rules/images/sprite-generation

常见问题

在新的网络协议下,精灵图还重要吗?

这个技能说,HTTP/2 使精灵图的重要性降低,但对小图标仍然有用。

SVG 是更好的选择吗?

这个技能把 SVG 图标系统描述为比精灵图更灵活、更现代的替代方案。

图标字体怎么样?

这个技能提到,对大多数图标用途而言,内联 SVG 或图标字体都是可选方案。

详情

作者的原始描述

Use when reviewing image assets, markup, and CDN or build transforms related to Use image sprites where appropriate. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.

repo: thedaviddias/Front-End-Checklist

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能