4 ms·
Doesn't `react-svg-loader`[0] do the same? [0] https://github.com/boopathi/react-svg-loader https://github.com/boopathi/react-svg-loader
by photonios 9y ago
Doesn't `react-svg-loader`[0] do the same?
[0] https://github.com/boopathi/react-svg-loader https://github.com/boopathi/react-svg-loader
- Klonoar 9y agoI'd done this awhile ago with https://github.com/ryanmcgrath/react-iconpack https://github.com/ryanmcgrath/react-iconpack (haven't touched it in literally forever, at least insofar as time is considered in the JavaScript world - probably doesn't work now), too. Never caught on for whatever reason, but was fun to hack together. I do feel like (and I think another commenter somewhere in here noted this) that actually fully converting SVGs to JS has a lot of detriments in terms of ability to edit and such, so the loader approach is better.
- photonios 9y agoAnother approach which I use at work is to use `postcss-inline-svg`[0]. This allows you to "import' the SVG from your CSS and then customize it. For example, you might want the icon in a different color: background: svg-load('myicon.svg', fill=blue); The SVG would then be inlined into the CSS instead of the HTML. [0] https://github.com/TrySound/postcss-inline-svg https://github.com/TrySound/postcss-inline-svg