How to use svg file as component??
I have a lot of svg files (.svg)
I want to import it as Solid component.
Is there solid primitives?
Please don't tell me to use any kind of unknown developers plugins.
I want to try official ways.
2 Replies
I don't think there is an official way, but there is https://github.com/jfgodoy/vite-plugin-solid-svg
GitHub
GitHub - jfgodoy/vite-plugin-solid-svg: Vite plugin to Import SVG f...
Vite plugin to Import SVG files as Solid.js Components - GitHub - jfgodoy/vite-plugin-solid-svg: Vite plugin to Import SVG files as Solid.js Components
I see foxpro made some PRs for it and they r really active on this server.
If u don't wanna rely on a vite plugin I assume u could always just change the extension to jsx and export the svg, since svg is valid HTML.