@stasgavrylov
Lead Frontend Engineer @ Rails Reactor
Slides:
https://slides.com/stasgavrylov/svg-workflow/live
create-react-app
eject
pencil.svg
Option 0: <img> tag
Option 1: Duplicate files
Option 2: Inline SVGs
Option 3: Icon Font
Inline SVG vs Icon Fonts [CSS-Tricks]
Option 4:
"npm run eject" + some-svg-loader
Option 5: SVG Sprites
svg-sprite + svg4everybody + <use>
svg-sprite
My basic script
svg4everybody
Adds external SVG support for all browsers
<use> element
Simplest use case
<SVGIcon /> (code)
SvgIcon.css
App.js
svg-sprite [npm]
svg4everybody [npm]
<SvgIcon />
By Stas Gavrylov
Using SVG sprites in single page apps