Skip to content

vitepress安装

vitepress有两种使用方式:

在项目中使用

在项目中使用的话,一般就是用来作为项目开发的文档,比如项目的架构介绍、公共封装的代码的使用、团队的规范等等。

单独使用

单独使用可以用来作为个人博客之类的写作网站。

安装

  • 在项目中使用,直接在项目根目录初始化,位置一般就写 ./docs
  • 单独使用就直接在一个空目录内初始化,位置写 ./
sh
$ npx vitepress init
sh
$ pnpm dlx vitepress init
sh
$ bunx vitepress init
  Welcome to VitePress!

  Where should VitePress initialize the config?
  ./docs

  Site title:
  My Awesome Project

  Site description:
  A VitePress Site

  Theme:
 Default Theme (Out of the box, good-looking docs)
 Default Theme + Customization
 Custom Theme

实际操作(mac 环境下):

shell
  demo mkdir vitepress
  demo cd vitepress 
  vitepress pnpm dlx vitepress init

  Welcome to VitePress!

  Where should VitePress initialize the config?
  ./

  Site title:
  notes

  Site description:
  wangcaiyuan notes

  Theme:
  Default Theme

  Use TypeScript for config and theme files?
  Yes

  Add VitePress npm scripts to package.json?
  Yes

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

  vitepress code .
  vitepress ls
api-examples.md      markdown-examples.md notebooks            pnpm-lock.yaml
index.md             node_modules         package.json