搭建 VuePress:Github & Aliyun
说明
- VuePress 2.0 构建报错,懒得折腾,继续使用 1.0
- 使用 Github Actions 部署到 Github Pages 和阿里云虚拟主机FTP(传输有点慢)
# 指定目录
mkdir Library
cd Library
1
2
2
# 安装依赖
警告
不要全局安装,选择依赖安装
yarn init
yarn add -D vuepress
1
2
2
npm init
npm install -D vuepress
1
2
2
// Make sure to add code blocks to your code group
在 package.json 中,新增启动命令:
"scripts": {
"docs:dev": "set NODE_OPTIONS=--openssl-legacy-provider && vuepress dev docs",
"docs:build": "set NODE_OPTIONS=--openssl-legacy-provider && vuepress build docs"
}
1
2
3
4
2
3
4
注意
构建报错:Error: error:0308010C:digital envelope routines::unsupported
搜索说是 Node.js 版本问题,得每次运行 set NODE_OPTIONS=--openssl-legacy-provider
索性直接加到 package.json 中
# 启动项目
yarn docs:dev
1
npm docs:dev
1
// Make sure to add code blocks to your code group
新增 .gitignore 文件(git 上传忽略),按需添加想要的内容,如:
#Idea
.idea
#VuePress
docs\.vuepress\dist
temp
cache
#NPM
node_modules
yarn.lock
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# 安装主题
懒得折腾直接使用主题
yarn add -D vuepress-theme-vdoing
1
npm install -D vuepress-theme-vdoing
1
// Make sure to add code blocks to your code group
然后在 config.js 中引用
theme: 'vdoing'
1
# 更新主题
yarn remove vuepress-theme-vdoing
#删除 node_modules 文件夹
yarn add -D vuepress-theme-vdoing
yarn
1
2
3
4
2
3
4
# 使用插件
#网络不行可以加上 --registry=https://registry.npmmirror.com
yarn add -D @vuepress/plugin-back-to-top
yarn add -D @vuepress/plugin-medium-zoom
yarn add -D @vuepress/plugin-last-updated
yarn add -D @vuepress/plugin-pwa
yarn add -D vuepress-plugin-fulltext-search
yarn add -D vuepress-plugin-reading-progress
yarn add -D vuepress-plugin-smplayer@1
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
#网络不行可以加上 --registry=https://registry.npmmirror.com
npm install -D @vuepress/plugin-back-to-top
npm install -D @vuepress/plugin-medium-zoom
npm install -D @vuepress/plugin-last-updated
npm install -D @vuepress/plugin-pwa
npm install -D vuepress-plugin-fulltext-search
npm install -D vuepress-plugin-reading-progress
npm install -D vuepress-plugin-smplayer@1
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
// Make sure to add code blocks to your code group
然后在 config.js 中引用
plugins: []
1
# 更多设置
网页编辑 (opens new window)
最近提交: 2023/03/22, 11:52:35