-
Notifications
You must be signed in to change notification settings - Fork 18
/
nuxt.siyuan.config.ts
151 lines (136 loc) · 3.63 KB
/
nuxt.siyuan.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
const generateDynamicV = () => {
const now = new Date()
const year = now.getFullYear().toString()
const month = (now.getMonth() + 1).toString().padStart(2, "0")
const day = now.getDate().toString().padStart(2, "0")
const hour = now.getHours().toString().padStart(2, "0")
const minute = now.getMinutes().toString().padStart(2, "0")
return year + month + day + hour + minute
}
const isDev = process.env.NODE_ENV === "development"
const appBase = "/plugins/siyuan-blog/"
const staticV = generateDynamicV()
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
// https://nuxt.com/docs/guide/concepts/typescript#nuxttsconfigjson
typescript: {
strict: true,
},
devtools: {
enabled: false,
},
// build modules
modules: [
"@vueuse/nuxt",
"@nuxtjs/i18n-edge",
"@element-plus/nuxt",
"@nuxtjs/color-mode",
"@pinia/nuxt",
"@nuxt/image",
],
// vueuse
vueuse: {
ssrHandlers: true,
},
i18n: {
vueI18n: "./i18n.ts",
},
// colorMode
// 格式是 `class="light-${classSuffix}"`,为空是 `class="light"`
colorMode: {
classSuffix: "",
},
image: {},
vite: {
define: {
"process.env.DEV_MODE": `"${isDev}"`,
"process.env.APP_BASE": `"${appBase}"`,
"process.env.SSR": `"false"`,
},
plugins: [],
css: {
preprocessorOptions: {
scss: {
api: "modern",
silenceDeprecations: ["mixed-decls", "color-functions", "global-builtin", "import", "new-global"],
},
},
},
},
elementPlus: {
icon: "ElIcon",
importStyle: "scss",
themes: ["dark"],
},
// https://nuxt.com/docs/guide/going-further/custom-routing#hash-mode-spa
ssr: false,
router: {
options: {
hashMode: true,
},
},
css: ["~/assets/siyuan/style.styl", "~/assets/siyuan/index.styl"],
app: {
baseURL: appBase,
head: {
charset: "utf-8",
viewport: "width=device-width, initial-scale=1",
htmlAttrs: {
lang: "zh_CN",
"data-theme-mode": "light",
"data-light-theme": "Zhihu",
"data-dark-theme": "Zhihu",
},
link: [
{ rel: "stylesheet", href: appBase + "libs/fonts/webfont.css?v=" + staticV },
{
rel: "stylesheet",
href: appBase + "resources/stage/build/app/base.css?v=" + staticV,
},
{
rel: "stylesheet",
href: appBase + "libs/katex/0.16.10/katex.min.css?v=" + staticV,
crossorigin: "anonymous",
},
],
// https://nuxt.com/docs/api/configuration/nuxt-config#head
script: isDev
? [
{
src: appBase + "libs/eruda/eruda.js",
},
{
children: "eruda.init();console.log('eruda inited');",
},
{
defer: true,
src: appBase + "libs/katex/0.16.10/katex.min.js",
},
]
: [
{
defer: true,
src: appBase + "libs/katex/0.16.10/katex.min.js",
},
],
},
},
// 环境变量
runtimeConfig: {
// siyuanAuthToken: process.env.NUXT_SIYUAN_AUTH_TOKEN,
siyuanAuthToken: "",
// siyuanCookie: process.env.NUXT_SIYUAN_COOKIE,
siyuanCookie: "",
public: {
// defaultType: process.env.NUXT_PUBLIC_DEFAULT_TYPE,
defaultType: "siyuan",
// siyuanApiUrl: process.env.NUXT_PUBLIC_SIYUAN_API_URL,
siyuanApiUrl: "",
// waitTime: process.env.NUXT_PUBLIC_WAIT_TIME,
waitTime: "0",
providerMode: "false",
providerUrl: "http://127.0.0.1:8000",
},
},
compatibilityDate: "2024-09-02",
})