【问题标题】:Locally building and pushing VuePress site to Github Pages本地构建 VuePress 站点并将其推送到 Github Pages
【发布时间】:2019-02-07 10:15:58
【问题描述】:

无法弄清楚将 Github 用作 VuePress 站点源代码控制和 deploying it to Github Pages 的工作流程。

当我第一次运行deploy.sh 时,它给了我一个围绕init 命令的Github 证书错误并且没有初始化新的repo(我已经有一个repo 设置,所以不确定init 命令是否在deploy.sh 是必需的。deploy.sh 的后续运行没有错误。

**问题:**不幸的是,当我访问 my Github Pages site 时,它没有使用 VuePress 模板。

我觉得我有: - 文件夹结构错误 - baseconfig.js 中设置不正确 - deploy.sh中的相关文件夹不正确

有人可以关注这个并提供一些反馈吗?谢谢。

供您参考

本机文件夹结构:

user@system:~/powerDocs$ tree
.
├── deploy.sh
├── docs
│   └── README.md
├── node_modules
│   └── yarn
│       ├── bin
│       │   ├── yarn
│       │   ├── yarn.cmd
│       │   ├── yarn.js
│       │   ├── yarnpkg
│       │   └── yarnpkg.cmd
│       ├── lib
│       │   ├── cli.js
│       │   └── v8-compile-cache.js
│       ├── LICENSE
│       ├── package.json
│       └── README.md
├── package.json
├── package-lock.json
└── README.md

5 directories, 15 files

deploy.sh的内容:

#!/usr/bin/env sh

# abort on errors
set -e

# build
vuepress build

# navigate into the build output directory
cd docs/.vuepress/dist

# if you are deploying to a custom domain
# echo 'www.example.com' > CNAME

git init
git add -A
git commit -m 'deploy'

# if you are deploying to https://<USERNAME>.github.io
# git push -f git@github.com:SeaDude/SeaDude.github.io.git master

# if you are deploying to https://<USERNAME>.github.io/<REPO>
git push -f git@github.com:SeaDude/powerDocs.git master:gh-pages

cd -

我使用 chmod +x deploy.sh 使 deploy.sh 可执行。运行 ./deploy.sh 会得到以下输出:

user@system:~/powerDocs$ ./deploy.sh 

 WAIT  Extracting site metadata...
[12:05:53 PM] Compiling Client
[12:05:53 PM] Compiling Server
(node:15590) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
[12:05:57 PM] Compiled Server in 3s
[12:05:59 PM] Compiled Client in 6s
 WAIT  Rendering static HTML...

 DONE  Success! Generated static files in .vuepress/dist.

Reinitialized existing Git repository in /home/powerDocs/docs/.vuepress/dist/.git/
On branch master
nothing to commit, working directory clean

这里是config.js的内容:

module.exports = {
  title: "PowerDocs",
  description: "Where functions go to frolic.",
  base: "/powerDocs/",

  themeConfig: {
    nav: [
      { text: "Home", link: "/" }
    ],
    sidebar: [
      '/'
    ]
  }
};

【问题讨论】:

    标签: github github-pages vuepress


    【解决方案1】:

    您是否检查过您的dist 文件夹以查看实际输出的内容?该错误使构建后似乎没有要提交的文件。

    我在本地有几乎相同的设置并且没有遇到这个问题,唯一的区别是我运行构建的命令是yarn docs:build

    【讨论】:

    • 嗨,山姆。请原谅极其迟到的回应!是的,dist 文件夹包含一个 assets 文件夹、一个 index.html404.html 文件。但正如您在链接中看到的那样,seadude.github.io/powerDocs,生成的站点没有使用 VuePress 模板。还有其他想法吗?
    猜你喜欢
    • 2012-11-26
    • 1970-01-01
    • 2013-12-23
    • 1970-01-01
    • 2011-06-12
    • 2020-03-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多