Svger CLI – 零依赖的 SVG 转组件工具,速度比 SVGR 快 52%
我正在开发一个名为 SVGER 的开源命令行工具,它可以将 SVG 文件转换为可直接使用的组件,支持 React、Vue 3、Angular、Svelte、Solid 以及其他多个框架,且完全支持 TypeScript,并具备树摇优化导出功能。
它的独特之处在于:
- 零运行时依赖 – 安装迅速,无捆绑膨胀,高安全性
- 内置优化器,通常能生成比 SVGO 更小的 SVG(自定义树状清理、路径简化、变换合并、形状转换)
- 在 600 多个图标的实际基准测试中:总耗时约 30 秒,每个文件约 50 毫秒,吞吐量为 20 个文件/秒 – 比 SVGR 快 52%,比 SVGO 快 33%,同时进行优化和组件生成
- 插件系统(已包含渐变优化器、笔画标准化器等)
- 在 CI 中自动化视觉回归测试,以确保输出的像素完美
- 支持并行处理,易于与 Vite、Webpack、Next.js 等集成
该工具旨在适用于从小型副项目到大型设计系统和企业单体仓库的各种场景。
非常希望听到 HN 社区的反馈 – 无论是星标、问题,还是对改进方向的想法。
在线实时基准测试链接:https://faezemohades.github.io/svger-cli/
谢谢!
查看原文
I've been working on an open-source CLI tool called SVGER that converts SVGs into ready-to-use components for React, Vue 3, Angular, Svelte, Solid, and several other frameworks – all with full TypeScript support and tree-shakable exports.
What sets it apart:<p>Zero runtime dependencies – installs instantly, no bundle bloat, high security profile
Built-in optimizer that often produces smaller SVGs than SVGO (custom tree-based cleanup, path simplification, transform collapsing, shape conversion)
In real-world benchmarks on 600+ icons: ~30s total, ~50ms per file, 20 files/sec throughput – 52% faster than SVGR and 33% faster than SVGO while doing both optimization and component generation
Plugin system (already shipped with gradient optimizer, stroke normalizer, etc.)
Automated visual regression testing in CI to guarantee pixel-perfect output
Parallel processing and easy integration with Vite/Webpack/Next.js/etc.<p>It's designed for everything from small side projects to large design systems and enterprise monorepos.
Would love to hear feedback from the HN community – stars, issues, or just thoughts on where it could improve.
Live online benchmark: https://faezemohades.github.io/svger-cli/
Thanks!