forked from nuxt-themes/docus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.ts
106 lines (102 loc) · 2.49 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { createResolver, logger, defineNuxtModule } from '@nuxt/kit'
import { $fetch } from 'ofetch'
import { version } from './package.json'
import appModule from './app/module'
const { resolve } = createResolver(import.meta.url)
// That allows to overwrite these dependencies paths via `.env` for local development
const envModules = {
tokens: process?.env?.THEME_DEV_TOKENS_PATH || '@nuxt-themes/tokens',
elements: process?.env?.THEME_DEV_ELEMENTS_PATH || '@nuxt-themes/elements',
studio: process?.env?.THEME_DEV_STUDIO_PATH || '@nuxthq/studio',
typography: process?.env?.THEME_DEV_TYPOGRAPHY_PATH || '@nuxt-themes/typography'
}
const updateModule = defineNuxtModule({
meta: {
name: '@nuxt-themes/docus'
},
setup (_, nuxt) {
if (nuxt.options.dev) {
$fetch('https://registry.npmjs.org/@nuxt-themes/docus/latest').then((release) => {
if (release.version > version) {
logger.info(`A new version of Docus (v${release.version}) is available: https://github.com/nuxt-themes/docus/releases/latest`)
}
}).catch(() => {})
}
}
})
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
routeRules: {
'/api/search': {
prerender: true,
cache: {}
}
},
app: {
head: {
htmlAttrs: {
lang: 'en'
}
}
},
extends: [
envModules.typography,
envModules.elements
],
modules: [
envModules.tokens,
envModules.studio,
'@nuxtjs/color-mode',
'@nuxt/content',
'@vueuse/nuxt',
appModule,
updateModule as any
],
css: [
resolve('./assets/css/main.css')
],
components: [
{
prefix: '',
path: resolve('./components/app'),
global: true
},
{
prefix: '',
path: resolve('./components/docs'),
global: true
}
],
pinceau: {
studio: true
},
content: {
documentDriven: true,
highlight: {
theme: {
dark: 'github-dark',
default: 'github-light'
},
preload: ['json', 'js', 'ts', 'html', 'css', 'vue', 'diff', 'shell', 'markdown', 'yaml', 'bash', 'ini']
},
navigation: {
fields: ['icon', 'titleTemplate', 'header', 'main', 'aside', 'footer']
}
},
colorMode: {
classSuffix: '',
dataValue: 'theme'
},
features: {
inlineStyles: false
},
typescript: {
includeWorkspace: true
},
nitro: {
prerender: {
ignore: ['/__pinceau_tokens_config.json', '/__pinceau_tokens_schema.json'],
routes: ['/opensearch.xml']
}
},
})