-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
enhanceApp.js
32 lines (30 loc) · 1.2 KB
/
enhanceApp.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
import VueAnnouncer from '@vue-a11y/announcer'
import VueDarkMode from '@vue-a11y/dark-mode'
import 'a11y-css-reset/combo.css'
import merge from 'deepmerge'
import VueSkipTo from 'vue-skip-to'
import FigureCode from './components/FigureCode.vue'
import FigureCodeCaption from './components/FigureCodeCaption.vue'
import WarningOpenLinkNewWindow from './components/WarningOpenLinkNewWindow.vue'
import { axe as axeDefaultConfig } from './config/defaultThemeConfig'
import { isObject } from './utils'
export default ({ Vue, router, isServer, siteData }) => {
// built-in components
Vue.component('WarningOpenLinkNewWindow', WarningOpenLinkNewWindow)
Vue.component('FigureCode', FigureCode)
Vue.component('FigureCodeCaption', FigureCodeCaption)
// Development
if (process.env.NODE_ENV === 'development') {
const axeConfig = siteData.themeConfig.axe && isObject(siteData.themeConfig.axe) ? merge(axeDefaultConfig, siteData.themeConfig.axe) : axeDefaultConfig
if (axeConfig.enabled) {
const VueAxe = require('vue-axe').default
Vue.use(VueAxe, axeConfig.options)
}
}
// Client only
if (!isServer) {
Vue.use(VueSkipTo)
Vue.use(VueDarkMode)
Vue.use(VueAnnouncer, {}, router)
}
}