Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline SVG to React by Vite #10

Open
ai opened this issue Aug 16, 2023 · 1 comment
Open

Inline SVG to React by Vite #10

ai opened this issue Aug 16, 2023 · 1 comment

Comments

@ai
Copy link
Member

ai commented Aug 16, 2023

I am taking about files like https://github.com/mikhin/vite-figma/blob/main/src/ui/components/Lurkers.tsx

Having SVG in JSX files leads to a few problems:

  1. You can’t view SVG files in system image viewer
  2. You can’t edit SVG files in GUI editor
  3. You can’t use scripts like svgo on these SVG files

Vite has a few tools to convert SVG file to React component automatically https://dev.to/cassidoo/importing-svg-files-as-react-components-with-vite-l3n

@ai
Copy link
Member Author

ai commented Aug 16, 2023

And you can use dynamic styles like fill by using CSS Custom Properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant