config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import {defineConfig} from 'vitepress';
  2. import {applyPlugins} from '@ruabick/md-demo-plugins';
  3. import {genTemp} from '@ruabick/vite-plugin-gen-temp';
  4. import {genApiDoc} from '@ruabick/vite-plugin-gen-api-doc';
  5. import {chineseSearchOptimize, pagefindPlugin} from 'vitepress-plugin-pagefind'
  6. import {sidebar} from './sidebar.js';
  7. import {resolve} from 'path';
  8. export default defineConfig({
  9. lang: 'zh-CN',
  10. lastUpdated: true,
  11. title: "hc-vue3-ui",
  12. themeConfig: {
  13. logo: '/favicon.ico',
  14. outlineTitle: '此页的大纲',
  15. nav: [
  16. {
  17. text: '使用说明',
  18. link: '/guide/index'
  19. },
  20. {
  21. text: '组件库',
  22. link: '/components/app-config/index'
  23. },
  24. {
  25. text: '方法函数',
  26. link: '/guide/index'
  27. },
  28. {
  29. text: '资料导航',
  30. link: '/guide/index'
  31. },
  32. {
  33. text: '1.0.0',
  34. items: [
  35. {
  36. text: '更新日志',
  37. link: '/CHANGELOG.md'
  38. }
  39. ]
  40. }
  41. ],
  42. sidebar,
  43. },
  44. vue: {},
  45. vite: {
  46. plugins: [
  47. genTemp(), genApiDoc(),
  48. pagefindPlugin({
  49. btnPlaceholder: '搜索',
  50. placeholder: '搜索文档',
  51. emptyText: '空空如也',
  52. heading: '共: {{searchResult}} 条结果',
  53. customSearchQuery: chineseSearchOptimize
  54. })
  55. ],
  56. resolve: {
  57. alias: {
  58. 'docs': resolve('./src/'),
  59. },
  60. },
  61. server: {
  62. port: 3300,
  63. }
  64. },
  65. markdown: {
  66. config: (md) => {
  67. applyPlugins(md);
  68. },
  69. theme: {
  70. light: 'github-light',
  71. dark: 'github-dark',
  72. },
  73. },
  74. buildEnd() {
  75. process.exit(0);
  76. },
  77. });