Skip to content

Commit

Permalink
✨ (theme) add hooks from module
Browse files Browse the repository at this point in the history
  • Loading branch information
Tahul committed May 17, 2021
1 parent ae02a7e commit c020a16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
8 changes: 1 addition & 7 deletions src/defaultTheme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 5 additions & 12 deletions src/defaultTheme/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,7 @@ export default <Module>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 || {}),
Expand Down Expand Up @@ -84,4 +73,8 @@ export default <Module>function themeSetupModule() {
nuxt.options.watch.push(componentsDirPath)
}
})

hook('ready', readyHook)

hook('build:before', beforeBuildHook)
}

0 comments on commit c020a16

Please sign in to comment.