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

Auto Import icons #21

Open
KareemDa opened this issue Oct 8, 2021 · 5 comments
Open

Auto Import icons #21

KareemDa opened this issue Oct 8, 2021 · 5 comments
Labels
question Further information is requested

Comments

@KareemDa
Copy link

KareemDa commented Oct 8, 2021

I'm using a bunch of MDI icons in my project.

So firstly. I've imported all icons. Now I want to reduce size of the bundle by importing only used icons.
Is there any way to import them automatically ?

@klausXR
Copy link

klausXR commented Nov 18, 2021

Bump, is there any way to use dynamic imports with this library?

@Templarian
Copy link
Owner

We have solution coded for the new MDI website that we want to bundle and share eventually, but right now other than copying @mdi/svg to your assets folder and fetching them there is not a nice solution.

Until then there is no out of the box solution to this problem for those that need dynamic access to any icon during runtime.

@klausXR
Copy link

klausXR commented Dec 9, 2021

Is there an ETA or is it not a high priority one?

@Templarian
Copy link
Owner

@klausXR Unfortunately I haven't had a lot of free time. Our solution relies on a 3rd party IndexedDB library that is a bit heavy for those using it for simple caching icons. It's on my list of things to code, but I would rank it lower priority.

@Templarian Templarian added the question Further information is requested label Jul 22, 2022
@samehdoush
Copy link

samehdoush commented Dec 23, 2022

any solution ?
i tried :
vue 3

vite 4

vuetify 3

const getIcon = async (iconName) => {
    return { [iconName]: icon } = await import('@mdi/js')
}

<template>
    <Suspense>
    <v-icon >

      {{ getIcon('mdiAccount') }}
    </v-icon>
</Suspense>
</template>

Error: <path> attribute d: Expected moveto path command ('M' or 'm'), "async () =\u003E {\r\n …".

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

No branches or pull requests

4 participants