Svger CLI – 零依赖的 SVG 转组件工具,比 SVGR 快 52%

3作者: navid_rezadoost6 个月前
我一直在开发一个名为 SVGER 的开源 CLI 工具,它可以将 SVG 转换为可直接用于 React、Vue 3、Angular、Svelte、Solid 以及其他一些框架的组件——所有这些都完全支持 TypeScript,并且可以进行 tree-shaking 导出。 它的独特之处在于: * 零运行时依赖——即时安装,无捆绑膨胀,高安全性 * 内置优化器,通常生成的 SVG 比 SVGO 更小(自定义树形清理、路径简化、变换合并、形状转换) * 在 600 多个图标的实际基准测试中:总共约 30 秒,每个文件约 50 毫秒,20 个文件/秒的吞吐量——比 SVGR 快 52%,比 SVGO 快 33%,同时进行优化和组件生成 * 插件系统(已附带梯度优化器、描边规范化器等) * 在 CI 中进行自动视觉回归测试,以保证像素级完美的输出 * 并行处理,易于与 Vite/Webpack/Next.js 等集成 它专为各种项目而设计,从小型 side project 到大型设计系统和企业 monorepo 都能胜任。 希望听到来自 HN 社区的反馈——点赞、问题,或者只是关于它可以在哪些方面改进的想法。 在线实时基准测试:https://faezemohades.github.io/svger-cli/ 谢谢!
查看原文
I&#x27;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&#x2F;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&#x2F;Webpack&#x2F;Next.js&#x2F;etc.<p>It&#x27;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:&#x2F;&#x2F;faezemohades.github.io&#x2F;svger-cli&#x2F; Thanks!