Перейти к содержанию
Skillpedia
Сайты и интерфейсы (фронтенд)75k · #3042

svg-inline

Что он делает

Этот скилл проверяет SVG-графику, записанную прямо в HTML или в компоненты. Он нужен разработчикам, которые хотят ускорить страницы без потери дизайна.

Когда использовать

  • ✓Когда на странице есть большие встроенные SVG-рисунки, из-за которых HTML становится тяжёлым.
  • ✓Когда один и тот же значок скопирован во многие места сайта.
  • ✓Когда вы проверяете, нужно ли SVG быть встроенным или его можно вынести в отдельный файл изображения.

Ссылка на скилл

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

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/svg-inline/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Моя главная страница медленная, а HTML огромный. Часть из-за большого SVG-логотипа, вставленного прямо в код. Проверь его, пожалуйста.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Агент измеряет каждый встроенный SVG, проверяет, повторяется ли он, и выясняет, нужен ли ему встроенный вариант. Затем он рекомендует более компактные или внешние варианты.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

Manage inline SVG size and complexity

A complex illustration exported from Figma can easily be 50-200KB of SVG markup. Inlined in HTML, it blocks the HTML parser until it is processed, cannot be cached independently, and balloons every page response. Extracting it to an external file allows browser caching and deferred loading. For icon systems, SVG sprites or component libraries avoid duplicating path data across every page.

Quick Reference

  • Only inline SVG when you need CSS hover/animation on individual paths—static SVGs belong in <img> tags
  • Keep inline SVGs under 1KB (ideally under 500 bytes) after SVGO optimisation
  • Reused icons should be SVG sprites or framework components—not copied inline multiple times
  • Run all SVGs through SVGO before inlining to strip editor artefacts

Check

Scan HTML files and React/Vue components for inline <svg> elements. For each inline SVG: 1) Measure its character count—flag any over 1KB (approximately 1000 characters). 2) Check if it is reused in multiple places (should be a component or sprite). 3) Check if SVGO has been run (look for redundant attributes, inline styles that could be CSS classes, or editor comments). 4) Check if the SVG needs to be inline for CSS styling/animation, or if <img src="file.svg"> would suffice. Report each large inline SVG with its size and location.

Fix

For each problematic inline SVG: 1) Large, non-interactive SVG (e.g., illustration): extract to .svg file and reference with <img src="illustration.svg" alt="...">. 2) Reused icon: create an SVG sprite or React component. 3) SVG needing CSS interactivity (hover, animation): keep inline but run through SVGO first—remove editor artefacts, merge paths, remove redundant attributes. 4) For React projects, use SVGR to import SVGs as components—they tree-shake unused SVGs. 5) Show before/after size comparison.

Explain

Explain the trade-offs of inline SVG. Inline SVG allows CSS styling (fill, stroke) and JavaScript animation on individual paths, which external SVG files or <img> elements cannot support. However, large inline SVGs bloat the HTML, delay HTML parser completion, cannot be cached separately from the page, and duplicate markup when used in multiple places. The guidance is: use inline SVG only when you need CSS/JS interactivity; use <img src="file.svg"> or CSS background for static SVGs; use SVG sprites or React components for reused icons.

Code Review

Review image assets, markup, and delivery configuration related to Manage inline SVG size and complexity. 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/svg-inline

Частые вопросы

Когда оставить SVG встроенным?

Скилл говорит, что встроенный SVG полезен, когда нужны наведение или анимация CSS для отдельных частей. Статичная графика обычно лучше смотрится в теге изображения.

Какой размер считается слишком большим?

Скилл советует держать встроенные SVG после оптимизации примерно до 1 КБ, а лучше до 500 байт.

Скилл удаляет графику?

Нет. Он предлагает перенести её во внешние файлы или спрайты, а не удалять.

Подробности

Оригинальное описание автора

Use when reviewing image assets, markup, and CDN or build transforms related to Manage inline SVG size and complexity. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.

repo: thedaviddias/Front-End-Checklist

Популярность

Звёзды на GitHub
75k
Место в рейтинге
#3042
Лицензия
MIT
Обновлён
31.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы