gitFoxCode / nuxt-icons

Module for Nuxt allowing pleasant use of svg icons
188 stars 23 forks source link

How can it be loaded on demand? #5

Closed cdwmhcc closed 1 year ago

cdwmhcc commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago
  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 commented 1 year ago

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

cdwmhcc commented 1 year ago

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

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