diff --git a/src/defaultTheme/module.ts b/src/defaultTheme/module.ts index 57aa6f5ff..47fbf4344 100644 --- a/src/defaultTheme/module.ts +++ b/src/defaultTheme/module.ts @@ -53,6 +53,8 @@ export default function themeSetupModule() { const { options, hook } = nuxt const { settings } = $docus + // Windi glob used for includes + const windiGlob = '/**/*.{html,vue,md,mdx,pug,jsx,tsx,svelte,css}' // Get Windi config at user project level const localWindiConfig = loadWindiConfig(options) @@ -60,6 +62,9 @@ export default function themeSetupModule() { // Merge user and theme Windi configs windiOptions.config = defu.arrayFn(windiOptions.config || {}, localWindiConfig || {}, defaultWindiConfig) + // Resolve admin runtime path + const adminPath = join(__dirname, '../admin') + // Glob grabbing all Docus files const transformFiles = await fg('**/*.{vue,css}', { cwd: join(options.rootDir, '/node_modules/docus/dist'), @@ -73,23 +78,17 @@ export default function themeSetupModule() { detect: transformFiles.filter((f: string) => f.endsWith('.vue')) } - // Trailing glob used for includes - const glob = '/**/*.{html,vue,md,mdx,pug,jsx,tsx,svelte,css}' - - // Resolve admin runtime path - const adminPath = join(__dirname, '../admin') - // Push every included path into scan options windiOptions.scanOptions.include.push( - join(adminPath, glob), - join(__dirname, glob), - join(options.rootDir, '/node_modules/docus/dist' + glob), - join(options.themeDir, glob) + join(adminPath, windiGlob), + join(__dirname, windiGlob), + join(options.rootDir, '/node_modules/docus/dist' + windiGlob), + join(options.themeDir, windiGlob) ) // Merge shortcuts windiOptions.config.shortcuts = { - ...(windiOptions.shortcuts || {}), + ...(windiOptions.config.shortcuts || {}), ...(settings?.theme?.shortcuts || {}) }