mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-23 16:30:45 +01:00
feat(module): improve options
This commit is contained in:
@@ -11,16 +11,26 @@ export interface ModuleOptions {
|
||||
* @defaultValue U
|
||||
*/
|
||||
prefix?: string
|
||||
|
||||
/**
|
||||
* Colors to generate classes for (based on TailwindCSS colors)
|
||||
* @defaultValue ['red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose']
|
||||
*/
|
||||
colors?: string[]
|
||||
|
||||
/**
|
||||
* Disable color transitions
|
||||
* Enable or disable `@nuxt/fonts` module
|
||||
* @defaultValue true
|
||||
*/
|
||||
transitions?: boolean
|
||||
fonts?: boolean
|
||||
|
||||
theme?: {
|
||||
/**
|
||||
* Enable or disable transitions on components
|
||||
* @defaultValue true
|
||||
*/
|
||||
transitions?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export default defineNuxtModule<ModuleOptions>({
|
||||
@@ -34,7 +44,10 @@ export default defineNuxtModule<ModuleOptions>({
|
||||
defaults: {
|
||||
prefix: 'U',
|
||||
colors: undefined,
|
||||
transitions: true
|
||||
fonts: true,
|
||||
theme: {
|
||||
transitions: true
|
||||
}
|
||||
},
|
||||
async setup(options, nuxt) {
|
||||
const { resolve } = createResolver(import.meta.url)
|
||||
@@ -65,10 +78,12 @@ export default defineNuxtModule<ModuleOptions>({
|
||||
nuxt.options.postcss.plugins['@tailwindcss/postcss'] = {}
|
||||
}
|
||||
|
||||
if (!hasNuxtModule('@nuxt/fonts')) {
|
||||
await installModule('@nuxt/fonts', { experimental: { processCSSVariables: true } })
|
||||
} else {
|
||||
nuxt.options.fonts = defu(nuxt.options.fonts, { experimental: { processCSSVariables: true } })
|
||||
if (options.fonts) {
|
||||
if (!hasNuxtModule('@nuxt/fonts')) {
|
||||
await installModule('@nuxt/fonts', { experimental: { processCSSVariables: true } })
|
||||
} else {
|
||||
nuxt.options.fonts = defu(nuxt.options.fonts, { experimental: { processCSSVariables: true } })
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasNuxtModule('@nuxt/icon')) {
|
||||
|
||||
Reference in New Issue
Block a user