From c020a161f2c9729dd3bc4f51bb9b0a6c48ea4b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yae=CC=88l=20GUILLOUX?= Date: Tue, 18 May 2021 01:00:45 +0200 Subject: [PATCH] :sparkles: (theme) add hooks from module --- src/defaultTheme/index.ts | 8 +------- src/defaultTheme/module.ts | 17 +++++------------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/defaultTheme/index.ts b/src/defaultTheme/index.ts index 320dbf112..658936e25 100644 --- a/src/defaultTheme/index.ts +++ b/src/defaultTheme/index.ts @@ -42,13 +42,7 @@ const themeConfig: NuxtConfig = nuxtConfig({ } ], plugins: [r('./plugins/menu')], - modules: [themeSetupModule, 'nuxt-windicss', '@nuxtjs/color-mode'], - hooks: { - ready: readyHook, - build: { - before: beforeBuildHook - } - } + modules: [themeSetupModule, 'nuxt-windicss', '@nuxtjs/color-mode'] }) export default themeConfig diff --git a/src/defaultTheme/module.ts b/src/defaultTheme/module.ts index fd643b52b..fa0106020 100644 --- a/src/defaultTheme/module.ts +++ b/src/defaultTheme/module.ts @@ -42,18 +42,7 @@ export default function themeSetupModule() { windiOptions.config = defu.arrayFn(windiOptions.config || {}, defaultWindiConfig) // Include local & npm depencies directories in scan process - windiOptions.scanOptions.dirs.push( - __dirname, - join(__dirname, '/node_modules/docus/dist'), - join(options.rootDir, '/node_modules/docus/dist'), - join(options.themeDir) - ) - - windiOptions.scanOptions.include.push( - join(__dirname, '/**/*.{html,vue,md,mdx,pug,jsx,tsx,svelte}'), - join(options.rootDir, '/node_modules/docus/dist/**/*.{html,vue,md,mdx,pug,jsx,tsx,svelte}'), - join(options.themeDir, '/**/*.{html,vue,md,mdx,pug,jsx,tsx,svelte}') - ) + windiOptions.scanOptions.dirs.push(__dirname, join(options.rootDir, '/node_modules/docus/dist'), options.themeDir) windiOptions.config.shortcuts = { ...(windiOptions.shortcuts || {}), @@ -84,4 +73,8 @@ export default function themeSetupModule() { nuxt.options.watch.push(componentsDirPath) } }) + + hook('ready', readyHook) + + hook('build:before', beforeBuildHook) }