svg-inline
ما الذي تفعله
تراجع هذه المهارة رسومات SVG المكتوبة مباشرة داخل HTML أو المكونات. وهي موجهة إلى المطورين الذين يريدون صفحات أسرع دون أن يفقدوا التصميم.
متى تستخدمها
- ✓عندما تحتوي الصفحة على رسومات SVG مضمّنة كبيرة تُثقل كود HTML.
- ✓عندما تُنسخ الأيقونة نفسها في أماكن كثيرة من الموقع.
- ✓عندما تراجع هل يحتاج SVG إلى أن يكون مضمّنًا أم يمكن أن يكون ملف صورة منفصلًا.
رابط المهارة
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/svg-inline/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“الصفحة الرئيسية لموقعي بطيئة وكود HTML ضخم. جزء منه شعار SVG كبير مُلصق مباشرة. هل يمكنك فحصه؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يقيس الوكيل كل 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 بايت.
هل تحذف هذه المهارة الرسومات؟
لا. بل تقترح نقلها إلى ملفات خارجية أو sprites بدلًا من حذفها.
التفاصيل
الوصف الأصلي من المؤلف
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.
الشعبية
- نجوم GitHub
- 75k
- الترتيب
- #3042
- الترخيص
- MIT
- آخر تحديث
- 31/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
frontendchecklist
75kيفحص شيفرة الواجهة الأمامية والصفحات الحية مقابل أكثر من 380 قاعدة للوصول وسرعة الأداء وتحسين محركات البحث والأمان، بأداة سطر أوامر.
frontend-checklist-global
75kيدقق مشروع الواجهة الأمامية وفق كل قواعد Front-End Checklist البالغ عددها 386، ويقدم إصلاحًا محددًا لكل مشكلة وجدت.
404-page
75kيتأكد من أن صفحة الصفحات غير الموجودة تقدم روابط مفيدة وتُرجع رمز حالة 404 حقيقيًا، لمساعدة الزوار التائهين على إيجاد طريقهم.
about-page
75kيراجع ما إذا كان لموقعك صفحة «من نحن» واضحة تشرح من يديره، لبناء الثقة لدى الزوار ومحركات البحث.
مهارات مشابهة
angular-developer
280kيساعد وكيلك على كتابة شيفرة Angular وتقديم نصائح لبنية المشروع، ويفيد في بدء المشاريع الجديدة وإنشاء المكونات وتحسين الأداء وإمكانية الوصول.
frontend-a11y
280kيساعد وكيلك على جعل واجهات الويب متاحة للجميع، فيضمن أن المواقع والتطبيقات تعمل جيدًا مع قارئات الشاشة والتنقل بلوحة المفاتيح.
frontend-patterns
280kيطبّق وكيلك أنماط تطوير الواجهات الحديثة، فيحسّن الأداء ويدير الحالة ويتبع أفضل الممارسات في React وNext.js.