icon icon indicating copy to clipboard operation
icon copied to clipboard

[Feature Request] Option to disable cache (localStorage)

Open renegadevi opened this issue 2 years ago • 4 comments

Iconify by default has cache enabled, this is good for performance but because it uses localStorage, it's something that may not always be initially wanted. As for Iconify, it creates more entries the more icons you use.

Skärmavbild 2023-06-24 kl  18 18 42

Iconify has a built-in function to disable this, but I cannot find any way to disable it with this module, such as in module options in the nuxtIcon-config which would had been very useful. https://iconify.design/docs/iconify-icon/disable-cache.html

By default, localStorage is enabled, sessionStorage is disabled.

renegadevi avatar Jun 24 '23 16:06 renegadevi

Do you want to disable it in development only @renegadevi ?

Because it production this can lead to serious performance drawbacks.

atinux avatar Jun 30 '23 08:06 atinux

Do you want to disable it in development only @renegadevi ?

Yes this is mainly during development or testing.

renegadevi avatar Jun 30 '23 11:06 renegadevi

Have you try adding a plugin to do it @renegadevi

// plugins/iconify.ts
import { disableCache } from 'iconify-icon';

export default defineNuxtPlugin(() => {
  if (process.dev) {
    disableCache('all')
  }
})

atinux avatar Aug 07 '23 11:08 atinux

Sadly not. I tried it with the nuxt-icons and just standalone iconify-icons, both still cached.

renegadevi avatar Aug 09 '23 11:08 renegadevi