/* * @LastEditTime: 2024-06-04 17:53:48 * @Description: ... * @Date: 2023-09-19 19:04:57 * @Author: isboyjc * @LastEditors: isboyjc */ import path from 'path' import { fileURLToPath } from 'url'; import { defineConfig } from 'vitepress' // 原子CSS UnoCSS import UnoCSS from "unocss/vite"; // 组件自动引入 import Components from 'unplugin-vue-components/vite' // Iconify 解析插件 import Icons from 'unplugin-icons/vite' // Iconify 自动引入解析器 import IconsResolver from 'unplugin-icons/resolver' // icon 加载 loader import { FileSystemIconLoader } from 'unplugin-icons/loaders' import {description, title, titleEn, descriptionEn, keywords, ico, site, icp, publicSecurityFiling, mail} from './meta' import {icons} from "./icon" const __dirname = path.dirname(fileURLToPath(import.meta.url)); const resolve = (dir) => dir ? path.resolve(__dirname, '../', dir) : __dirname // https://vitepress.dev/reference/site-config export default defineConfig({ lang: 'zh', locales: { root: { label: '简体中文', lang: 'zh', title, description, link: '/', head: [ ['meta', { name: 'referrer', content: 'no-referrer-when-downgrade' }], ['meta', { name: 'keywords', content: keywords }], ['meta', { name: 'author', content: 'isboyjc' }], ['meta', { name: 'application-name', content: title }], ['meta', { name: 'apple-mobile-web-app-title', content: title }], ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'default' }], ['link', { rel: 'shortcut icon', href: ico }], ['link', { rel: 'icon', type: 'image/x-icon', href: ico }], // ['link', { rel: 'mask-icon', href: '.svg', color: '#06f' }], // ['meta', { name: 'theme-color', content: '#06f' }], // webfont ['link', { rel: 'dns-prefetch', href: 'https://fonts.googleapis.com' }], ['link', { rel: 'dns-prefetch', href: 'https://fonts.gstatic.com' }], ['link', { rel: 'preconnect', crossorigin: 'anonymous', href: 'https://fonts.googleapis.com' }], ['link', { rel: 'preconnect', crossorigin: 'anonymous', href: 'https://fonts.gstatic.com' }], // og ['meta', { property: 'og:type', content: 'website' }], ['meta', { property: 'og:description', content: description }], ['meta', { property: 'og:url', content: site }], ['meta', { property: 'og:locale', content: 'zh_CN' }], ], themeConfig: { outline: 'deep', outlineTitle: '目录...', returnToTopLabel: '返回顶部', darkModeSwitchLabel: '模式', sidebarMenuLabel: '归档', lastUpdatedText:"最后更新时间", docFooter: { prev: '上一页', next: '下一页', }, nav: [ { text: '快速了解', link: '/docs/guide' }, { text: '特色', link: '/#features' }, { text: '订阅', link: '/#subscribe' }, { text: '在线支持', link: '/docs/support' } ], sidebar: { '/docs': [ { text: '测试通告', link: '/docs/testing' }, { text: '快速了解', link: '/docs/guide' }, { text: '关于我们', link: '/docs/about' }, { text: '联系我们', link: '/docs/support' } ] }, }, }, en: { label: 'English', lang: 'en', title: titleEn, description: descriptionEn, link: '/en/', head: [ ['meta', { name: 'referrer', content: 'no-referrer-when-downgrade' }], ['meta', { name: 'keywords', content: keywords }], ['meta', { name: 'author', content: 'isboyjc' }], ['meta', { name: 'application-name', content: titleEn }], ['meta', { name: 'apple-mobile-web-app-title', content: titleEn }], ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'default' }], ['link', { rel: 'shortcut icon', href: ico }], ['link', { rel: 'icon', type: 'image/x-icon', href: ico }], // ['link', { rel: 'mask-icon', href: '.svg', color: '#06f' }], // ['meta', { name: 'theme-color', content: '#06f' }], // webfont ['link', { rel: 'dns-prefetch', href: 'https://fonts.googleapis.com' }], ['link', { rel: 'dns-prefetch', href: 'https://fonts.gstatic.com' }], ['link', { rel: 'preconnect', crossorigin: 'anonymous', href: 'https://fonts.googleapis.com' }], ['link', { rel: 'preconnect', crossorigin: 'anonymous', href: 'https://fonts.gstatic.com' }], // og ['meta', { property: 'og:type', content: 'website' }], ['meta', { property: 'og:description', content: descriptionEn }], ['meta', { property: 'og:url', content: site }], ['meta', { property: 'og:locale', content: 'zh_CN' }], ], themeConfig: { nav: [ { text: 'Guide', link: '/docs/guide' }, { text: 'Features', link: '/#features' }, { text: 'Subscribe', link: '/#subscribe' }, { text: 'Online Support', link: '/docs/support' } ], sidebar: { '/en/docs': [ { text: 'Test Notice', link: '/en/docs/testing' }, { text: 'Get Guide', link: '/en/docs/guide' }, { text: 'About Us', link: '/en/docs/about' }, { text: 'Contact Us', link: '/en/docs/support' } ] }, }, } }, themeConfig: { socialLinks: [ { icon: icons.mail, link: `Mailto:${mail}` } ], footer: { psf: publicSecurityFiling, icp: icp, }, }, markdown: { lineNumbers: true, }, // vite配置 vite: { plugins: [ // 插件 Components({ // dirs 指定自动引入组件所在目录位置 dirs: [resolve('.vitepress/theme/components')], include: [/\.vue$/, /\.vue\?vue/, /\.md$/], resolvers: [ IconsResolver({ prefix: 'icon', // 默认 iconify 集合别名 // alias: { // vsci: 'vscode-icons' // }, customCollections: ['custom'] }) ] }), Icons({ compiler: 'vue3', customCollections: { // custom 图标集, 给svg文件设置fill="currentColor"属性,使图标的颜色具有适应性 custom: FileSystemIconLoader('public/svg/custom', svg => svg.replace(/^