icon icon indicating copy to clipboard operation
icon copied to clipboard

Using nuxt-icon in a custom module

Open avxkim opened this issue 1 year ago • 7 comments

module.ts

installModule('nuxt-icon', {
  size: '24px',
})

But inlineOptions doesn't work, when i'm enabling this module inside a custom module.

avxkim avatar Mar 14 '24 10:03 avxkim

You can use nuxt.options.icon.size = '24px @avxkim

atinux avatar Mar 14 '24 13:03 atinux

@Atinux then i have to use useRuntimeConfig() in a component?

avxkim avatar Mar 14 '24 14:03 avxkim

i did this way:

module.ts

    nuxt.options.runtimeConfig.public.iconSize =
      options.iconSize

then in a component

const config = useRuntimeConfig()

const iconSize = computed(
  () => props.size || config.public.iconSize
)

is that ok?

avxkim avatar Mar 14 '24 14:03 avxkim

Oh my bad I just saw that we are using the app.config.ts for the configuration.

Could you try with nuxt.options.appConfig.icon.size = '24px' ?

atinux avatar Mar 14 '24 14:03 atinux

Cannot start nuxt: Cannot set properties of undefined (setting 'size')

avxkim avatar Mar 14 '24 14:03 avxkim

@Atinux is doing this

nuxt.options.runtimeConfig.public.iconSize =
      options.iconSize

considerd as a bad practice?

avxkim avatar Mar 14 '24 14:03 avxkim

You can do this yes

atinux avatar Mar 18 '24 09:03 atinux