繁体   English   中英

如何以root用户身份使用create-react-app更新自定义GitHub Pages

[英]how to update a custom GitHub Pages with create-react-app as root

您好,我在线阅读了许多有关将gh页与create-react-app连接的文档。 但是大多数指南都假设尚未设置github页面,并且react应用将作为目录(即username.github.io/react-app)而不是homepage / root(用户名)托管。 .github.io)。 我希望有人可以帮助我:

  1. 我有一个用于github页面自定义域的现有存储库。 目前,它托管着一个我用gulp和静态html / css / js构建的旧站点,以及一个用于自定义URL的CNAME文件。

  2. 我在单独的存储库中使用create-react-app构建了一个新的网站重新设计(它对多个页面使用react-router)。

  3. 我想用新的create-react-app网站作为根主页覆盖旧github页面网站的内容。

这可能吗? 如果是这样,实现此目标的最佳方法是什么? 谢谢

  1. 在现有的Github Pages应用中,删除CNAME和/或删除master分支。 删除master分支将删除该站点,而删除CNAME会将自定义域清除回默认的[username] .github.io。

  2. 在create-react-app中,将CNAME添加到/ public文件夹。

  3. 在create-react-app中,将"homepage":"./" to package.json添加行"homepage":"./" to package.json
  4. 在create-react-app中,运行npm run build然后运行gh-pages -d build构建过程,然后运行npm run deploy

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM