-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
96 lines (94 loc) · 2.69 KB
/
vite.config.ts
File metadata and controls
96 lines (94 loc) · 2.69 KB
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
import path from 'path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import CSSExports from 'vite-plugin-css-export'
import ESLint from '@nabla/vite-plugin-eslint'
import { plugin as Markdown, Mode } from 'vite-plugin-markdown'
import Stylelint from 'vite-plugin-stylelint'
import MarkdownIt from 'markdown-it'
import MarkdownItPrism from 'markdown-it-prism'
import MarkdownItAnchor from 'markdown-it-anchor'
import AutoImport from 'unplugin-auto-import/vite'
import Layouts from 'vite-plugin-vue-layouts'
import Pages from 'vite-plugin-pages'
import Components from 'unplugin-vue-components/vite'
import generateSitemap from 'vite-ssg-sitemap'
import packageJson from './package.json' with { type: 'json' }
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig(({ mode }) => ({
plugins: [
Vue(),
// https://github.com/nabla/vite-plugin-eslint
ESLint(),
// https://github.com/ModyQyW/vite-plugin-stylelint
Stylelint(),
// https://github.com/shixuanhong/vite-plugin-css-export/
CSSExports(),
// https://github.com/hmsk/vite-plugin-markdown
Markdown({
mode: [Mode.HTML, Mode.VUE, Mode.TOC],
markdownIt: MarkdownIt({ html: true, linkify: true })
.use(MarkdownItPrism)
.use(MarkdownItAnchor, {
permalink: MarkdownItAnchor.permalink.ariaHidden({
placement: 'before',
renderAttrs: () => ({ tabindex: -1 }),
}),
}),
}),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: ['vue', 'vue-router', '@vueuse/head', '@vueuse/core'],
dirs: ['docs/settings', 'docs/utils'],
vueTemplate: true,
dts: 'auto-imports.d.ts',
eslintrc: {
enabled: true,
},
}),
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
Layouts({ layoutsDirs: ['docs/layouts'] }),
// https://github.com/hannoeru/vite-plugin-pages
Pages({
dirs: ['docs/pages'],
routeBlockLang: 'yaml',
}),
// https://github.com/antfu/unplugin-vue-components
Components({
dirs: ['docs/components'],
}),
],
base: mode === 'development' ? './' : '/style/',
build: {
outDir: 'styleguide',
rolldownOptions: {
checks: {
pluginTimings: false,
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@docs': path.resolve(__dirname, './docs'),
},
},
// https://github.com/antfu/vite-ssg
ssgOptions: {
script: 'async',
formatting: 'minify',
onFinished() {
generateSitemap({
hostname: 'https://volverjs.github.io/style',
outDir: 'styleguide',
})
},
},
define: {
__APP_VERSION__: JSON.stringify(packageJson.version),
},
optimizeDeps: {
include: ['vue', 'vue-router', '@vueuse/core', '@vueuse/head'],
},
}))