如何以正确的方式在 Nuxt 项目中添加 Vuepress?
How to add Vuepress on a Nuxt project in a proper way?
我有我的 Nuxt 应用程序,我正在尝试在上面添加 Vuepress。
我做了 yarn add vuepress@next -D
,然后在其中创建了 docs
文件夹和一个 readme.md
文件。
问题: 如果 .vuepress
文件夹 在 docs
文件夹之外,项目只显示边栏和导航栏;如果它在里面,它将不起作用 - 不遵守 config.js 规则。
另外,它识别来自 Nuxt 应用程序的 readme.md(也在 docs 文件夹之外),而不是 docs 文件夹内的应用程序。
有人可以帮我吗?
另一个问题,如果以上方法有效,我是否可以通过 localhost:3000/docs
而不是 localhost:3000
访问 Nuxt 项目和 localhost:8080
访问文档?
这是我当前的文件夹结构(没有侧边栏显示 - 不尊重 .vuepress 文件夹内的 config.js):
docs
|__.vuepress
| |__config.js
|
|__guides
config.js 文件:
module.exports = {
title: 'Documentation',
description: 'Documentation',
themeConfig: {
sidebar: 'auto',
nav: [{
text: 'Home',
link: '/'
},
{
text: 'Guides A',
link: '/guides/apis/'
},
{
text: 'item with subitems',
items: [{
text: 'Subitem 01',
link: '/'
},
{
text: 'SubItem 02',
link: '/'
}
]
},
{
text: 'External',
link: 'https://google.com'
},
]
}
}
Vuepress 版本 1.0.2
谢谢。
为什么你需要同时使用这两个?如果你使用 Nuxt,你实际上并不需要 VuePress。查官方VuePress documentation.
Nuxt
Nuxt is capable of doing what VuePress does, but it is designed for building applications. VuePress is focused on content-centric static sites and provides features tailored for technical documentation out of the box.
我有我的 Nuxt 应用程序,我正在尝试在上面添加 Vuepress。
我做了 yarn add vuepress@next -D
,然后在其中创建了 docs
文件夹和一个 readme.md
文件。
问题: 如果 .vuepress
文件夹 在 docs
文件夹之外,项目只显示边栏和导航栏;如果它在里面,它将不起作用 - 不遵守 config.js 规则。
另外,它识别来自 Nuxt 应用程序的 readme.md(也在 docs 文件夹之外),而不是 docs 文件夹内的应用程序。
有人可以帮我吗?
另一个问题,如果以上方法有效,我是否可以通过 localhost:3000/docs
而不是 localhost:3000
访问 Nuxt 项目和 localhost:8080
访问文档?
这是我当前的文件夹结构(没有侧边栏显示 - 不尊重 .vuepress 文件夹内的 config.js):
docs
|__.vuepress
| |__config.js
|
|__guides
config.js 文件:
module.exports = {
title: 'Documentation',
description: 'Documentation',
themeConfig: {
sidebar: 'auto',
nav: [{
text: 'Home',
link: '/'
},
{
text: 'Guides A',
link: '/guides/apis/'
},
{
text: 'item with subitems',
items: [{
text: 'Subitem 01',
link: '/'
},
{
text: 'SubItem 02',
link: '/'
}
]
},
{
text: 'External',
link: 'https://google.com'
},
]
}
}
Vuepress 版本 1.0.2
谢谢。
为什么你需要同时使用这两个?如果你使用 Nuxt,你实际上并不需要 VuePress。查官方VuePress documentation.
Nuxt
Nuxt is capable of doing what VuePress does, but it is designed for building applications. VuePress is focused on content-centric static sites and provides features tailored for technical documentation out of the box.