mirror of
https://github.com/HoshinoSuzumi/rayine-ui.git
synced 2025-04-19 14:28:51 +08:00
➕ Add tailwind typo
This commit is contained in:
parent
42370a0692
commit
d3a4d54938
@ -37,6 +37,7 @@ declare module '@nuxt/schema' {
|
|||||||
|
|
||||||
export interface ModuleOptions {
|
export interface ModuleOptions {
|
||||||
prefix?: string
|
prefix?: string
|
||||||
|
globalComponents?: boolean
|
||||||
safeColors?: string[]
|
safeColors?: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
},
|
},
|
||||||
defaults: {
|
defaults: {
|
||||||
prefix: 'Ray',
|
prefix: 'Ray',
|
||||||
|
globalComponents: false,
|
||||||
safeColors: ['primary'],
|
safeColors: ['primary'],
|
||||||
},
|
},
|
||||||
async setup(_options, _nuxt) {
|
async setup(_options, _nuxt) {
|
||||||
@ -74,25 +76,25 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
addComponentsDir({
|
addComponentsDir({
|
||||||
path: resolve(runtimePath, 'components', 'elements'),
|
path: resolve(runtimePath, 'components', 'elements'),
|
||||||
prefix: _options.prefix,
|
prefix: _options.prefix,
|
||||||
global: false,
|
global: _options.globalComponents,
|
||||||
watch: false,
|
watch: false,
|
||||||
})
|
})
|
||||||
addComponentsDir({
|
addComponentsDir({
|
||||||
path: resolve(runtimePath, 'components', 'forms'),
|
path: resolve(runtimePath, 'components', 'forms'),
|
||||||
prefix: _options.prefix,
|
prefix: _options.prefix,
|
||||||
global: false,
|
global: _options.globalComponents,
|
||||||
watch: false,
|
watch: false,
|
||||||
})
|
})
|
||||||
addComponentsDir({
|
addComponentsDir({
|
||||||
path: resolve(runtimePath, "components", "overlays"),
|
path: resolve(runtimePath, "components", "overlays"),
|
||||||
prefix: _options.prefix,
|
prefix: _options.prefix,
|
||||||
global: false,
|
global: _options.globalComponents,
|
||||||
watch: false,
|
watch: false,
|
||||||
})
|
})
|
||||||
addComponentsDir({
|
addComponentsDir({
|
||||||
path: resolve(runtimePath, "components", "icons"),
|
path: resolve(runtimePath, "components", "icons"),
|
||||||
prefix: 'Icon',
|
prefix: 'Icon',
|
||||||
global: false,
|
global: _options.globalComponents,
|
||||||
watch: false,
|
watch: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -28,24 +28,28 @@ export const installTailwind = (
|
|||||||
})
|
})
|
||||||
|
|
||||||
const configTemplate = addTemplate({
|
const configTemplate = addTemplate({
|
||||||
filename: 'ray-tailwind.config.cjs',
|
filename: "ray-tailwind.config.cjs",
|
||||||
write: true,
|
write: true,
|
||||||
getContents: ({ nuxt }) => `
|
getContents: ({ nuxt }) => `
|
||||||
const { defaultExtractor: createDefaultExtractor } = require('tailwindcss/lib/lib/defaultExtractor.js')
|
const { defaultExtractor: createDefaultExtractor } = require('tailwindcss/lib/lib/defaultExtractor.js')
|
||||||
const { customSafelistExtractor, generateSafelist } = require(${JSON.stringify(
|
const { customSafelistExtractor, generateSafelist } = require(${JSON.stringify(
|
||||||
resolve(runtimePath, 'utils', 'colors'),
|
resolve(runtimePath, "utils", "colors")
|
||||||
)})
|
)})
|
||||||
|
|
||||||
const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } })
|
const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } })
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
require('@tailwindcss/aspect-ratio'),
|
||||||
|
require('@tailwindcss/typography')
|
||||||
|
],
|
||||||
content: {
|
content: {
|
||||||
files: [
|
files: [
|
||||||
${JSON.stringify(
|
${JSON.stringify(
|
||||||
resolve(runtimePath, 'components/**/*.{vue,mjs,ts}'),
|
resolve(runtimePath, "components/**/*.{vue,mjs,ts}")
|
||||||
)},
|
)},
|
||||||
${JSON.stringify(
|
${JSON.stringify(
|
||||||
resolve(runtimePath, 'ui.config/**/*.{mjs,js,ts}'),
|
resolve(runtimePath, "ui.config/**/*.{mjs,js,ts}")
|
||||||
)}
|
)}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -59,19 +63,19 @@ export const installTailwind = (
|
|||||||
return [
|
return [
|
||||||
...defaultExtractor(content),
|
...defaultExtractor(content),
|
||||||
...customSafelistExtractor(${JSON.stringify(
|
...customSafelistExtractor(${JSON.stringify(
|
||||||
moduleOptions.prefix,
|
moduleOptions.prefix
|
||||||
)}, content, ${JSON.stringify(
|
)}, content, ${JSON.stringify(
|
||||||
nuxt.options.appConfig.rayui.colors,
|
nuxt.options.appConfig.rayui.colors
|
||||||
)}, ${JSON.stringify(moduleOptions.safeColors)})
|
)}, ${JSON.stringify(moduleOptions.safeColors)})
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
safelist: generateSafelist(${JSON.stringify(
|
safelist: generateSafelist(${JSON.stringify(
|
||||||
moduleOptions.safeColors || [],
|
moduleOptions.safeColors || []
|
||||||
)}, ${JSON.stringify(nuxt.options.appConfig.rayui.colors)}),
|
)}, ${JSON.stringify(nuxt.options.appConfig.rayui.colors)}),
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
})
|
});
|
||||||
|
|
||||||
const { configPath: userTwConfigPath = [], ...twModuleConfig }
|
const { configPath: userTwConfigPath = [], ...twModuleConfig }
|
||||||
= nuxt.options.tailwindcss ?? {}
|
= nuxt.options.tailwindcss ?? {}
|
||||||
|
Loading…
Reference in New Issue
Block a user