mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-22 07:50:36 +01:00
feat(module)!: use tailwind-merge for app.config & move config to components & type props (#692)
Co-authored-by: Pooya Parsa <pooya@pi0.io>
This commit is contained in:
21
src/templates.ts
Normal file
21
src/templates.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { dirname } from 'pathe'
|
||||
import { useNuxt, addTemplate } from '@nuxt/kit'
|
||||
|
||||
export default function createTemplates (nuxt = useNuxt()) {
|
||||
const template = addTemplate({
|
||||
filename: 'ui.colors.mjs',
|
||||
getContents: () => `export default ${JSON.stringify(nuxt.options.appConfig.ui.colors)};`,
|
||||
write: true
|
||||
})
|
||||
const typesTemplate = addTemplate({
|
||||
filename: 'ui.colors.d.ts',
|
||||
getContents: () => `declare module '#ui-colors' { const defaultExport: ${JSON.stringify(nuxt.options.appConfig.ui.colors)}; export default defaultExport; }`,
|
||||
write: true
|
||||
})
|
||||
|
||||
nuxt.options.alias['#ui-colors'] = dirname(template.dst)
|
||||
|
||||
nuxt.hook('prepare:types', (opts) => {
|
||||
opts.references.push({ path: typesTemplate.dst })
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user