QC2168 / vite-plugin-vitepress-auto-sidebar

The vite plugin that automatically generates sidebar data by scanning directories, based on vitepress
MIT License
85 stars 12 forks source link

总是失败。请教config.mts文件具体怎么写,能否给个代码让我复制进去? #23

Closed fajianren closed 4 months ago

fajianren commented 5 months ago

image

fajianren commented 5 months ago

`import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config export default defineConfig({ title: "My Awesome Project", description: "A VitePress Site", themeConfig: { // https://vitepress.dev/reference/default-theme-config nav: [ { text: 'Home', link: '/' }, { text: 'Examples', link: '/markdown-examples' } ],

sidebar: [
  {
    text: 'Examples',
    items: [
      { text: 'Markdown Examples', link: '/markdown-examples' },
      { text: 'Runtime API Examples', link: '/api-examples' }
    ]
  }
],

socialLinks: [
  { icon: 'github', link: 'https://github.com/vuejs/vitepress' }
]

} }) `

具体怎么改啊

QC2168 commented 5 months ago

没有明白你的意思

QC2168 commented 5 months ago

你的服务不是跑成功了吗

fajianren commented 5 months ago

`import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config export default defineConfig({ title: "Kangyue.Pro", description: "A VitePress Site", themeConfig: { // https://vitepress.dev/reference/default-theme-config nav: [ { text: '1', link: '/' }, { text: '2', link: '/markdown-examples' } ],

module.exports = {

plugins: [ require('./my-plugin.js') ] }

sidebar: [
  {
    text: 'Examples',
    items: [
      { text: 'Markdown Examples', link: '/markdown-examples' },
      { text: 'Runtime API Examples', link: '/api-examples' }
    ]
  }
],

socialLinks: [
  { icon: 'github', link: '/' }
]

]

} }) `

以上是config.mts文件的内容。 要把: `import AutoSidebar from 'vite-plugin-vitepress-auto-sidebar';

export default defineConfig({ vite: { plugins: [ // add plugin AutoSidebar({ // You can also set options to adjust sidebar data // see option document below }) ] }, })`

添加到哪里? (我是小白)

fajianren commented 5 months ago

请教config.mts文件具体怎么写

fajianren commented 5 months ago

image 具体怎么生成啊?有没有教程啊?

fajianren commented 5 months ago

image

QC2168 commented 4 months ago
import AutoSidebar from 'vite-plugin-vitepress-auto-sidebar';

export default defineConfig({
  vite: {
    plugins: [
      // add plugin
      AutoSidebar()
    ]
  },
})

config中填写这个即可自动生成,然后你按正常一样跑项目即可

fajianren commented 4 months ago

谢谢回复。原有的内容要覆盖掉吗?还是? ---- 回复的原邮件 ---- @.>发送日期2024年4月10日 @.>@.>, @.>主题Re: [QC2168/vite-plugin-vitepress-auto-sidebar] 总是失败。请教config.mts文件具体怎么写,能否给个代码让我复制进去? (Issue #23) import AutoSidebar from 'vite-plugin-vitepress-auto-sidebar'; export default defineConfig({ vite: { plugins: [ // add plugin AutoSidebar() ] }, }) 在config中填写这个即可自动生成,然后你按正常一样跑项目即可 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

QC2168 commented 4 months ago

这个需要根据你的业务来进行调整,示例里只是最小demo