-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.js
80 lines (71 loc) · 2.13 KB
/
main.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { createPinia } from 'pinia';
import './style.css';
import 'element-plus/dist/index.css';
import App from './App.vue';
import { routes } from './router';
import { install as VueMonacoEditorPlugin } from '@guolao/vue-monaco-editor';
import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/preview.css';
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css';
import './css/index.scss';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import { OhVueIcon, addIcons } from 'oh-vue-icons';
import AppLink from './components/AppLink.vue';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import {
BiChevronDoubleUp,
BiChevronDoubleDown,
BiChevronBarUp,
BiChevronDoubleRight,
HiSolidExternalLink,
IoCloseCircleOutline,
MdDeleteforeverOutlined,
FaCopy
} from 'oh-vue-icons/icons';
addIcons(
BiChevronDoubleUp,
BiChevronDoubleDown,
BiChevronBarUp,
BiChevronDoubleRight,
HiSolidExternalLink,
IoCloseCircleOutline,
MdDeleteforeverOutlined,
FaCopy
);
import { ViteSSG } from 'vite-ssg';
// prismjs
import Prism from 'prismjs';
// highlightjs
import 'highlight.js/styles/stackoverflow-light.css';
// import hljs from 'highlight.js/lib/core';
import './utils/highlightjs';
let ssgRouter;
export const createApp = ViteSSG(
App,
{ routes },
({ app, router, initialState }) => {
VMdPreview.use(vuepressTheme, {
Prism
});
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
// TODO: https://github.com/antfu-collective/vite-ssg?tab=readme-ov-file#initial-state
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component);
}
app.use(VueMonacoEditorPlugin, {
paths: {
// The recommended CDN config
vs: 'https://cdn.jsdelivr.net/npm/monaco-editor@0.50.0/min/vs'
}
});
app.component('VIcon', OhVueIcon);
app.component('AppLink', AppLink);
app.use(router);
app.use(pinia);
app.use(VMdPreview);
ssgRouter = router;
}
);
export { ssgRouter };