vuepress 快速创建自己文档

官方文档:https://vuepress.vuejs.org/zh...

开始

1、创建并进入一个新目录

mkdir vuepress-starter && cd vuepress-starter

2、使用你喜欢的包管理器进行初始化
有时候yarn init 失败,就有npm init

yarn init # npm init

3、将 VuePress 安装为本地依赖

yarn add -D vuepress # npm install -D vuepress

4、创建你的第一篇文档

mkdir docs && echo '# Hello VuePress' > docs/README.md

第四点命令主要在根目录(vuepress-starter)下创建docs文件夹,在docs下面创建README.md
image.png
5、在 package.json 中添加一些 scripts

{
  "scripts": {
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  }
}

6、在本地启动服务器

yarn docs:dev # npm run docs:dev

image.png

VuePress 会在 http://localhost:8080 (opens new window)启动一个热重载的开发服务器。

7.打开http://localhost:8080/,看到下面图,基本完成了,本地开发基本完成了
image.png

8.怎么部署在github静态服务上,可以常考下面【参考】文章

9.在vscode中直接运行bash deploy.sh会报错,所以在git bash 中执行
image.png

参考:

  https://chasellhl.github.io/myBlog/web/vue/vuePress_deploy_2.html#小坑2(部分人会踩)
  https://www.cnblogs.com/LHLVS/p/11376732.html
  
  windows:没有bash ,请在git bash 

mark
33 声望2 粉丝