mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-19 14:31:47 +01:00
chore: simplify theme imports in dev (#3851)
This commit is contained in:
@@ -50,12 +50,13 @@ export function getTemplates(options: ModuleOptions, uiConfig: Record<string, an
|
||||
}
|
||||
|
||||
// For local development, import directly from theme
|
||||
if (process.argv.at(-1) === '--uiDev') {
|
||||
const isUiDev = true
|
||||
if (isUiDev) {
|
||||
const templatePath = fileURLToPath(new URL(`./theme/${kebabCase(component)}`, import.meta.url))
|
||||
return [
|
||||
`import template from ${JSON.stringify(templatePath)}`,
|
||||
...generateVariantDeclarations(variants),
|
||||
`const result = typeof template === 'function' ? template(${JSON.stringify(options, null, 2)}) : template`,
|
||||
`const result = typeof template === 'function' ? (template as Function)(${JSON.stringify(options, null, 2)}) : template`,
|
||||
`const theme = ${json}`,
|
||||
`export default result as typeof theme`
|
||||
].join('\n\n')
|
||||
|
||||
Reference in New Issue
Block a user