npx nuxt module add site-confignpm i nuxt-site-configYou will need to manually add the module to your Nuxt config.
export default defineNuxtConfig({
modules: [
'nuxt-site-config',
],
})
yarn add nuxt-site-configYou will need to manually add the module to your Nuxt config.
export default defineNuxtConfig({
modules: [
'nuxt-site-config',
],
})
pnpm i nuxt-site-configYou will need to manually add the module to your Nuxt config.
export default defineNuxtConfig({
modules: [
'nuxt-site-config',
],
})
bun i nuxt-site-configYou will need to manually add the module to your Nuxt config.
export default defineNuxtConfig({
modules: [
'nuxt-site-config',
],
})
For Nuxt apps, see the Site Config Guide for usage.
Use the install function in your module:
import { installNuxtSiteConfig, updateSiteConfig } from 'nuxt-site-config/kit'
export default defineNuxtModule({
// ...
async setup(options) {
await installNuxtSiteConfig()
// Optional: set some site config from your modules options
// This is not recommended, only to keep supporting your modules options
updateSiteConfig({
_context: 'my-module',
url: options.siteUrl,
})
}
})
That's it! Explore the documentation to learn more.