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

Using nuxt-icon in a custom module #146

Open
avxkim opened this issue Mar 14, 2024 · 7 comments
Open

Using nuxt-icon in a custom module #146

avxkim opened this issue Mar 14, 2024 · 7 comments

Comments

@avxkim
Copy link

avxkim commented Mar 14, 2024

module.ts

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

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

Copy link
Member

atinux commented Mar 14, 2024

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

@avxkim
Copy link
Author

avxkim commented Mar 14, 2024

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

@avxkim
Copy link
Author

avxkim commented Mar 14, 2024

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?

Copy link
Member

atinux commented Mar 14, 2024

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' ?

@avxkim
Copy link
Author

avxkim commented Mar 14, 2024

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

@avxkim
Copy link
Author

avxkim commented Mar 14, 2024

@atinux is doing this

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

considerd as a bad practice?

Copy link
Member

atinux commented Mar 18, 2024

You can do this yes

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