svg-inline
Fungsinya
Skill ini meninjau grafik SVG yang ditulis langsung di dalam HTML atau komponen. Skill ini cocok untuk developer yang menginginkan halaman lebih cepat tanpa mengorbankan desain.
Kapan dipakai
- āSaat halaman berisi gambar SVG inline berukuran besar yang membuat HTML menjadi berat.
- āSaat ikon yang sama disalin ke banyak tempat di situs.
- āSaat meninjau apakah SVG perlu inline atau bisa menjadi file gambar terpisah.
Link skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/svg-inline/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
āHalaman utama saya lambat dan HTML-nya sangat besar. Sebagian isinya adalah logo SVG besar yang ditempel langsung. Bisakah Anda memeriksanya?ā
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent mengukur setiap SVG inline, memeriksa apakah ada yang berulang, dan apakah benar-benar perlu inline. Setelah itu agent merekomendasikan opsi yang lebih kecil atau eksternal.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Kapan boleh mempertahankan SVG inline?
Skill menyatakan SVG inline berguna jika Anda memerlukan efek hover atau animasi CSS pada bagian tertentu. Grafik statis biasanya lebih cocok di tag gambar.
Berapa ukuran yang dianggap terlalu besar?
Skill menyarankan SVG inline di bawah sekitar 1KB setelah dioptimalkan, dan idealnya di bawah 500 byte.
Apakah skill ini menghapus grafiknya?
Tidak. Skill menyarankan memindahkannya ke file eksternal atau sprite, bukan menghapusnya.
Detail
Deskripsi asli dari pembuat
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.
Popularitas
- Bintang GitHub
- 75k
- Peringkat
- #3042
- Lisensi
- MIT
- Diperbarui
- 31/10/2026
Komentar
- ā¦
Skill lain dari repositori ini
frontendchecklist
75kMemeriksa kode frontend dan halaman langsung terhadap lebih dari 380 aturan untuk aksesibilitas, kecepatan, SEO, dan keamanan, dengan alat baris perintah.
frontend-checklist-global
75kMengaudit proyek frontend terhadap seluruh 386 aturan Front-End Checklist, dan memberikan perbaikan spesifik untuk setiap masalah yang ditemukan.
404-page
75kMemeriksa bahwa halaman tidak ditemukan Anda menawarkan tautan yang membantu dan mengembalikan status 404 yang sebenarnya, untuk membantu pengunjung yang tersesat.
about-page
75kMeninjau apakah situs Anda memiliki halaman Tentang yang jelas yang menjelaskan siapa yang mengelolanya, untuk membangun kepercayaan pengunjung dan mesin pencari.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.