nuxt / icon

The <Icon> component, supporting Iconify, Emojis and custom components.
https://stackblitz.com/edit/nuxt-icon-playground?file=app.vue
MIT License
864 stars 37 forks source link

[Feature Request] iconify-icon support #139

Open Endermanch opened 5 months ago

Endermanch commented 5 months ago

Since Nuxt is an SSR-oriented framework, I would like to propose a shift from @iconify/vue to iconify-icon, as that would make rendering heaps more consistent and lighter, reaping the benefits of using a Shadow DOM.

Reads: https://github.com/vuetifyjs/vuetify/issues/7821#issuecomment-1876623426 https://iconify.design/docs/iconify-icon/

cyberalien commented 4 months ago

Yes, this is a very good idea.

I'm actually using iconify-icon with Nuxt on new Iconify icon sets website, it is way better for SSR than @iconify/vue. Works flawlessly.

One minor change is it requires adding this line to Nuxt config (it works fine without it, but shows warnings in console in dev mode):

    vue: {
        compilerOptions: {
            isCustomElement: (tag) => tag === 'iconify-icon',
        },
    },

Additionally, version 2 of web component has major performance increase. It uses IntersectionObserver to check if icon is visible, does not render icons that aren't visible to visitor.

Old Iconify components, such as @iconify/vue (and especially @iconify/react) has been a big pain to maintain because of SSR. In future I'm planning to deprecate them, asking users to switch to web component.

danwithabox commented 4 months ago

This would be very much appreciated from the point of view of a new Nuxt adopter 🎉

As I'm evaluating the framework, coming across such situations where the "best" solution differs from the "official" solution causes some friction and unease.