Optimize a directory of SVG icons with svgo so each icon is under 1 KB, and report before/after sizes per file.
Runs svgo over a directory of SVG icons with a profile tuned for icon use cases (preserving viewBox, removing fill if monochrome icons are themed via CSS), and reports per-file size deltas. Targets each icon being under 1 KB.
icons_dir: directory containing .svg files.monochrome: if true, strip fill attributes so CSS can color them (default true).keep_ids: array of <g id="..."> IDs to preserve (e.g., for animation targets).find <icons_dir> -name '*.svg' -type f and capture each file's byte size.svgo.config.js:
module.exports = {
plugins: [
{ name: 'preset-default', params: { overrides: { removeViewBox: false } } },
'removeDimensions',
'removeXMLNS',
<if monochrome:> { name: 'removeAttrs', params: { attrs: '(fill|stroke)' } },
],
};
npx svgo --multipass --config svgo.config.js -f <icons_dir>. The --multipass flag iterates until stable.svgo --plugin=convertPathData --plugin=mergePaths.viewBox (some hand-authored SVGs use width/height only); restore by reading the original first if needed.d=) and its length.svg-optimization.md.svg-optimization.md with a summary table (count, total bytes before, total bytes after, savings%) plus a per-file table sorted by absolute bytes saved. The optimized SVGs replace originals in icons_dir.
Render each optimized SVG inline in a small HTML harness and visually compare against the original (e.g., with playwright's screenshot diff at icon scale). Confirm xmlns="http://www.w3.org/2000/svg" is preserved if the icons will be served standalone (svgo's removeXMLNS only safe for inline use). Re-measure with wc -c and confirm the report's numbers.
<use href="external.svg#foo">): keep IDs and don't remove defs.fill attributes: respect monochrome=false and preserve fills.removeUnusedNS and mergePaths to avoid breaking visual appearance.Other publishers' experience with this skill. Self-rating is blocked.
Ratings are limited to publishers while the registry is small — sign in and publish a public skill to rate.
No ratings yet. Be the first.
Same domains or capabilities as amitte/svg-icon-optimizer.
Write five Google Ads responsive search ad copy variants from a product description and audience — each fits headline length and includes a distinct CTA.
Find CSS or JS animations that trigger layout or paint instead of compositor-only properties and propose property swaps with sample diffs.
Read a Lighthouse or CrUX report and narrate LCP, CLS, and INP scores into a prioritized fix plan with concrete code suggestions.
Tighten a Content-Security-Policy by stripping wildcards and verifying the result against actual page resource loads observed in browser logs.
Identify unused CSS classes via PurgeCSS and propose a configuration that's safe in the presence of dynamically constructed class names.
Audit a Tailwind config for color contrast in dark mode and flag every text-on-background pair below WCAG AA thresholds.