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

Support dynamic import #14

Open
eriandev opened this issue Nov 25, 2020 · 1 comment
Open

Support dynamic import #14

eriandev opened this issue Nov 25, 2020 · 1 comment
Labels
hacktoberfest help wanted Extra attention is needed

Comments

@eriandev
Copy link

To be able to import it in a dynamic way in order to get the name of the icon to be imported through a prop, something like this:

<script>
  import { onMount } from 'svelte'

  export let name
  let SVGComponent

  onMount(async () => {
    const SVG = await import(`@assets/icons/${name}.svg`)
    SVGComponent = SVG
  })
</script>

<svelte:component this={SVGComponent}/>
@vish01
Copy link

vish01 commented Apr 16, 2021

Any updates on this yet?

@MKRhere MKRhere added hacktoberfest help wanted Extra attention is needed labels Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants