element-plus/docs/.vitepress/config/head.ts
三咲智子 a5dd21e94a
docs(build): refactor config & support dev without pre build (#3743)
* docs: refactor config

* docs(build): support dev without pre build

* docs: disable sourcemap
2021-09-30 19:26:30 +08:00

47 lines
949 B
TypeScript

import fs from 'fs'
import path from 'path'
import { languages } from '../utils/lang'
import { vpRoot } from '../utils/paths'
import { features } from './features'
import type { HeadConfig } from 'vitepress'
export const head: HeadConfig[] = [
[
'link',
{
rel: 'icon',
href: '/images/element-plus-logo-small.svg',
},
],
[
'link',
{
rel: 'stylesheet',
href: '//fonts.loli.net/css?family=Inter:300,400,500,600|Open+Sans:400,600;display=swap',
},
],
[
'link',
{
rel: 'stylesheet',
href: '//unpkg.com/nprogress@0.2.0/nprogress.css',
},
],
[
'script',
{},
`;(() => {
window.supportedLangs = ${JSON.stringify(languages)}
})()`,
],
['script', {}, fs.readFileSync(path.resolve(vpRoot, 'lang.js'), 'utf-8')],
]
if (features.theme) {
head.push([
'script',
{},
fs.readFileSync(path.resolve(vpRoot, 'dark-mode.js'), 'utf-8'),
])
}