-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathvite.config.js
59 lines (53 loc) · 1.23 KB
/
vite.config.js
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
import {sveltekit} from '@sveltejs/kit/vite'
import md from 'markdown-it'
import markdownItAnchor from 'markdown-it-anchor'
import {plugin as vitePluginMarkdown, Mode} from 'vite-plugin-markdown'
import hljs from 'highlight.js'
import hljs_svelte from 'highlightjs-svelte'
import svg from '@poppanator/sveltekit-svg'
const svgPlugin = svg({
svgoOptions: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
'removeDimensions',
],
},
})
const markdownIt = md({
typographer: true,
highlight: function (str, lang) {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(str, {language: lang}).value
} catch {
console.log(`error highlighting for ${lang}`)
}
}
return '' // use external default escaping
},
}).use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.headerLink({safariReaderFix: true}),
})
hljs_svelte(hljs)
const mdPlugin = vitePluginMarkdown({
mode: Mode.HTML,
markdownIt,
})
/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit(), svgPlugin, mdPlugin],
test: {
mockReset: true,
environment: 'jsdom',
globals: true,
setupFiles: 'src/setupTests.ts',
},
}
export default config