Update enhanceApp.js
This commit is contained in:
parent
d480e0158b
commit
8fe0011f9a
@ -1,17 +1,6 @@
|
||||
import postMixin from '@theme/mixins/posts'
|
||||
import localMixin from '@theme/mixins/locales'
|
||||
|
||||
function _registerCodeThemeCss (theme = 'tomorrow') {
|
||||
const link = document.createElement('link')
|
||||
link.rel = 'stylesheet'
|
||||
if (theme === '') {
|
||||
link.href = `http://prismjs.com/themes/prism.css`
|
||||
} else {
|
||||
link.href = `http://prismjs.com/themes/prism-${theme}.css`
|
||||
}
|
||||
document.head.append(link)
|
||||
}
|
||||
|
||||
export default ({
|
||||
Vue,
|
||||
siteData,
|
||||
@ -23,3 +12,13 @@ export default ({
|
||||
_registerCodeThemeCss(siteData.themeConfig.codeTheme)
|
||||
}
|
||||
}
|
||||
|
||||
function _registerCodeThemeCss (theme = 'tomorrow') {
|
||||
const themeArr = ['tomorrow', 'funky', 'okaidia', 'solarizedlight', 'default']
|
||||
|
||||
const link = document.createElement('link')
|
||||
link.rel = 'stylesheet'
|
||||
link.href = `//prismjs.com/themes/prism${themeArr.indexOf(theme) > -1 ? `-${theme}` : ''}.css`
|
||||
|
||||
document.head.append(link)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user