mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 03:38:54 +01:00
feat(module): allow tailwind.css customization
This commit is contained in:
@@ -8,12 +8,22 @@ import * as theme from './theme'
|
|||||||
export function addTemplates(options: ModuleOptions, nuxt: Nuxt) {
|
export function addTemplates(options: ModuleOptions, nuxt: Nuxt) {
|
||||||
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
||||||
|
|
||||||
const template = addTemplate({
|
if (!nuxt.options.css.find(path => path.endsWith('tailwind.css'))) {
|
||||||
filename: 'tailwind.css',
|
const template = addTemplate({
|
||||||
write: true,
|
filename: 'tailwind.css',
|
||||||
getContents: () => `@import "tailwindcss";
|
write: true,
|
||||||
|
getContents: () => `@import "tailwindcss";
|
||||||
|
@import "#build/ui.css";
|
||||||
|
`
|
||||||
|
})
|
||||||
|
|
||||||
@layer base {
|
nuxt.options.css.unshift(template.dst)
|
||||||
|
}
|
||||||
|
|
||||||
|
addTemplate({
|
||||||
|
filename: 'ui.css',
|
||||||
|
write: true,
|
||||||
|
getContents: () => `@layer base {
|
||||||
:root {
|
:root {
|
||||||
color-scheme: light dark;
|
color-scheme: light dark;
|
||||||
}
|
}
|
||||||
@@ -42,8 +52,6 @@ export function addTemplates(options: ModuleOptions, nuxt: Nuxt) {
|
|||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
nuxt.options.css.unshift(template.dst)
|
|
||||||
|
|
||||||
for (const component in theme) {
|
for (const component in theme) {
|
||||||
addTemplate({
|
addTemplate({
|
||||||
filename: `ui/${kebabCase(component)}.ts`,
|
filename: `ui/${kebabCase(component)}.ts`,
|
||||||
|
|||||||
Reference in New Issue
Block a user