mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-01 12:47:57 +01:00
Initial commit
This commit is contained in:
34
src/index.ts
Normal file
34
src/index.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { join } from 'pathe'
|
||||
import { defineNuxtModule, installModule } from '@nuxt/kit'
|
||||
import presetUno, { colors } from '@unocss/preset-uno'
|
||||
import presetIcons from '@unocss/preset-icons'
|
||||
|
||||
export default defineNuxtModule({
|
||||
async setup (_options, nuxt) {
|
||||
const options = {
|
||||
theme: {
|
||||
colors: {
|
||||
primary: colors ? colors[_options?.primary || 'indigo'] : undefined
|
||||
}
|
||||
},
|
||||
presets: [
|
||||
presetUno(),
|
||||
presetIcons({
|
||||
prefix: ''
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
await installModule(nuxt, { src: '@unocss/nuxt', options })
|
||||
|
||||
nuxt.hook('components:dirs', (dirs) => {
|
||||
// Add ./components dir to the list
|
||||
dirs.push({
|
||||
path: join(__dirname, 'components'),
|
||||
prefix: _options.prefix || 'u'
|
||||
})
|
||||
})
|
||||
|
||||
nuxt.options.css.unshift('@unocss/reset/tailwind.css')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user