How to inline SVG assets? [question] #60
Unanswered
jesster2k10
asked this question in
Q&A
Replies: 1 comment
-
Hi Jesse! In Vite you can use Unfortunately, this setting currently ignores SVGs, probably because it's not desirable to base64-encode SVGs. See this related issue, which is being actively worked on. A potential workaround at the moment, is to use uppercase PS: Moved it to Discussions so that other folks can provide workarounds or plugins that already provide inlining. @jesster2k10 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description 📖
I'm currently trying to switch from Webpacker to Vite Ruby and things have been okay so far, except this one point of contention.
Currently, I'm using webpacker to house all my SVG assets. Some of which are included in my source bundle myself and others which I'm importing from NPM.
I import all my assets into a file called icons.ts:
and I'm able to inline the SVGs in my rails views using the inline_svg gem which depends on Webpacker internally, so is incompatible with Vite.
So I was trying to think of another way to achieve the same result without having to have two bundlers lying around, and I thought of possibly following along with this guide – https://thoughtbot.com/blog/organized-workflow-for-svg
and calling File.open and somehow referencing the asset using the
vite_asset_path
helper but I don't even think this is possible nor desirable.So is there any way to go about this while working within Vite?
Beta Was this translation helpful? Give feedback.
All reactions