GitHubPages快速发布原创
快速发布个人网站到github Pages
// 1.下载 gh-pages 包
npm install -D gh-pages
// 2. 在 package.json 文件上添加脚本命令
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
// 上面我修改了 VuePress 的输出目录,所以您如果没有修改 .vuepress/config.js
// 的 dest 属性,应该将这里的 dist 改为 .vuepress/dist
// 注意在使用 gh-pages 的时候请确保你已经添加了 git 远程仓库。
"deploy": "gh-pages -d dist",
"deploy:build": "npm run docs:build && gh-pages -d dist"
}
// 3. 打包并推送到 gh-pages 分支
npm run deploy:build
// 4.打开你的 Github pages, 地址是 https://<yourname>/github.io/<repo>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
gh pages详细信息如下
gh-pages@3.2.3 | MIT | deps: 7 | versions: 28
Publish to a gh-pages branch on GitHub (or any other branch on any other remote)
https://github.com/tschaub/gh-pages
bin: gh-pages, gh-pages-clean
dist
.tarball: https://registry.npmmirror.com/gh-pages/-/gh-pages-3.2.3.tgz
.shasum: 897e5f15e111f42af57d21d430b83e5cdf29472c
.integrity: sha512-jA1PbapQ1jqzacECfjUaO9gV8uBgU6XNMV0oXLtfCX3haGLe5Atq8BxlrADhbD6/UdG9j6tZLWAkAybndOXTJg==
dependencies:
async: ^2.6.1 email-addresses: ^3.0.1 find-cache-dir: ^3.3.1 globby: ^6.1.0
commander: ^2.18.0 filenamify: ^4.3.0 fs-extra: ^8.1.0
maintainers:
- markdalgleish <mark.john.dalgleish@gmail.com>
- tschaub <tim.schaub@gmail.com>
dist-tags:
beta: 1.0.0-beta.1 latest: 3.2.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
发布完成后,会自动把编译之后的dist文件夹push到远程分支的gh-pages 中。
详细的配置参数参考:GitHub gh-pages (opens new window)
最后在github 中配置相关的仓库信息即可。
参考资料:
npm的gh-pages结合github发布repository网站 (opens new window)
编辑 (opens new window)
上次更新: 2022/02/23, 18:17:51