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

How can it be loaded on demand? #5

Closed
cdwmhcc opened this issue Jun 22, 2022 · 4 comments
Closed

How can it be loaded on demand? #5

cdwmhcc opened this issue Jun 22, 2022 · 4 comments

Comments

@cdwmhcc
Copy link

cdwmhcc commented Jun 22, 2022

This scheme will write all svg to nuxticons.mjs file, my project has several thousand svg icons, nuxticons.mjs file will be over 5mb.

How can it be loaded on demand?

@gitFoxCode
Copy link
Owner

Hello! Currently it is not possible, I am still working on it and in the future I hope to succeed. In previous versions (without vite) it was much simpler

@cdwmhcc
Copy link
Author

cdwmhcc commented Jul 9, 2022

  1. create file /server/api/getIcon.ts
  2. create file /components/icon.tsx

Get the content of the svg icon through the server-side getIcon.ts api.
Render svg icon via component icon.txs.

Are there any downsides to this scheme?

@gitFoxCode gitFoxCode reopened this Jul 11, 2022
@gitFoxCode
Copy link
Owner

@cdwmhcc New version on nuxt 3.0.0 is now available, I encourage you to test it 😄

@cdwmhcc
Copy link
Author

cdwmhcc commented Nov 18, 2022

@cdwmhcc New version on nuxt 3.0.0 is now available, I encourage you to test it 😄

Wow, crazy, I'll test it later 👍👍👍

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

2 participants