VuePress搭建
VuePress搭建
初始化
创建并进入一个新目录
1
mkdir @docs && cd @docs使用你喜欢的包管理器进行初始化
1
yarn init # npm init将 VuePress 安装为本地依赖
我们已经不再推荐全局安装 VuePress
1
yarn add -D vuepress # npm install -D vuepress创建你的第一篇文档
1
mkdir docs && echo '# Hello VuePress' > docs/README.md在
package.json中添加一些 scripts(opens new window)这一步骤是可选的,但我们推荐你完成它。在下文中,我们会默认这些 scripts 已经被添加。
1
2
3
4
5
6{
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
}
}在本地启动服务器
1
yarn docs:dev # npm run docs:devVuePress 会在 http://localhost:8080 (opens new window)启动一个热重载的开发服务器。
目录对应规则
1 | |
docs/.vuepress: 用于存放全局的配置、组件、静态资源等。docs/.vuepress/components: 该目录中的 Vue 组件将会被自动注册为全局组件。docs/.vuepress/theme: 用于存放本地主题。docs/.vuepress/styles: 用于存放样式相关的文件。docs/.vuepress/styles/index.styl: 将会被自动应用的全局样式文件,会生成在最终的 CSS 文件结尾,具有比默认样式更高的优先级。docs/.vuepress/styles/palette.styl: 用于重写默认颜色常量,或者设置新的 stylus 颜色常量。docs/.vuepress/public: 静态资源目录。docs/.vuepress/templates: 存储 HTML 模板文件。docs/.vuepress/templates/dev.html: 用于开发环境的 HTML 模板文件。docs/.vuepress/templates/ssr.html: 构建时基于 Vue SSR 的 HTML 模板文件。docs/.vuepress/config.js: 配置文件的入口文件,也可以是YML或toml。docs/.vuepress/enhanceApp.js: 客户端应用的增强。
| 文件的相对路径 | 页面路由地址 |
|---|---|
/README.md |
/ |
/guide/README.md |
/guide/ |
/config.md |
/config.html |
首页
https://www.vuepress.cn/theme/default-theme-config.html#%E9%A6%96%E9%A1%B5
根目下的README.md
1 | |
添加关于页面
根目录下。about->README.md
导航栏
https://www.vuepress.cn/theme/default-theme-config.html#%E5%AF%BC%E8%88%AA%E6%A0%8F
.vuepress/config.js
部署到gitee
pack.json
1 | |
deploy.h (可以不用,这个作用是打包,和推送到远程分支)
1 | |

打包时发生错误,解决方案:


最后解决方案,把这个变量给删除了

安装pwa插件
https://www.vuepress.cn/plugin/official/plugin-pwa.html#%E5%AE%89%E8%A3%85
安装
1 | |
使用
1 | |
vssue评论
创建一个新的第三方应用

点击创建应用


获取 Client ID 和 Secret

安装
通过 NPM 安装 @vssue/vuepress-plugin-vssue 和你需要使用的 API 包 :(我这里用的是gitee,所以安装gitee相关的包)
1 | |
1 | |

图片有错误,owner应该应gitee账户
使用 Vssue 组件
1 | |

全局引入



back-to-top
安装
1 | |
使用
1 | |

VuePress搭建
http://example.com/2022/08/28/06.扩展/02.博客/03.VuePress搭建/