r/javascript • u/evoactivity • Apr 21 '26
SVG Jar - The best way to use SVGs in your web apps
github.comI've been planning to build this for a while and finally had a reason to get it done. I've been maintaining ember-svg-jar for a few years now. Ember has since moved to Vite, so migrating to an unplugin was the obvious choice which gave me the opportunity to build a plugin that any framework can use. Before building this I evaluated a bunch of different vite svg plugins but found them all lacking one thing or another that left them feature incomplete compared to what ember-svg-jar already offered.
Quick list of features
- Generates sprite sheets for your imported SVGs
- Named sprite sheets so you can collect related SVGs together
- Allows an inline embed as an escape hatch (you should have a good reason to inline)
- URL export when you want to use in an <img> (or some other reason)
- Embedded references are resolved (<use> <image> etc just work)
- DOM and Web Component runtimes in addition to framework components
Currently it supports vite and rollup bundlers, but I do plan on fleshing out support for everything unplugin supports, so if your project is using webpack or one of the newer bundlers like esbuild or rolldown check back soon.
I also plan to add more framework runtimes out the box, and a way to provide your own runtime module so no matter what you're building, SVG Jar will work with it.
This is new code so there is bound to be edge cases, if you run into one, please file an issue :)