Skip to content

创建完整的 VitePress 项目

初始化项目

首先,执行以下命令初始化项目并安装 VitePress:

shell
npm init
shell
npm add -D vitepress@next
shell
npx vitepress init

初始化配置选项

执行 npx vitepress init 后,会出现以下配置选项,按提示输入相应内容:

text
┌  Welcome to VitePress!

◇  Where should VitePress initialize the config?
│  ./docs

◇  Where should VitePress look for your markdown files?
│  ./docs

◇  Site title:
│  My Awesome Project

◇  Site description:
│  A VitePress Site

◇  Theme:
│  Default Theme

◇  Use TypeScript for config and theme files?
│  Yes

◇  Add VitePress npm scripts to package.json?
│  Yes

◇  Add a prefix for VitePress npm scripts?
│  Yes

◇  Prefix for VitePress npm scripts:
│  docs

└  Done! Now run pnpm run docs:dev and start writing.

Vue 作为 peer dependency

如果打算使用 Vue 组件或 API 进行自定义,还应该明确地将 vue 安装为 dependency。

尘埃虽微,积之成集;问题虽小,记之为鉴。 雾中低语,心之所向;思绪飘渺,皆可成章。