#Import svg as component with solid

7 messages · Page 1 of 1 (latest)

high sedge
#

Anyone is using Astro with Solid? How you do to import SVG as component?

gaunt wolfBOT
#

Hi @high sedge. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Yes, Astro supports using Solid as a first-class framework in your project. To import an SVG as a component, you can use the import statement in your Astro or Solid component. Here's an example:

import rocket from '../images/rocket.svg';

Then, you can use the imported SVG in your component like this:

<img src={rocket} alt="A rocketship in space." />

For more information on using Solid with Astro, refer to the Astro documentation on Solid (https://docs.astro.build/en/guides/integrations-guide/solid-js).

For more information on importing assets in Astro, refer to the Astro documentation on imports (https://docs.astro.build/en/guides/imports).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@high sedge kapa.ai is still learning and improving, please let us how it did by reacting below

high sedge
#

@gaunt wolf ok, but I want a import this svg as a component, like a vite plugin does

gaunt wolfBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the Astro documentation on imports (https://docs.astro.build/en/guides/imports) and the Vite documentation on plugins (https://vitejs.dev/guide/using-plugins.html) for more information on importing assets and using Vite plugins with Astro.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

Astro Documentation

Learn how to import different content types with Astro.

Next Generation Frontend Tooling