将 angular.js yeoman 部署到 GitHub 页面
Deploying angular.js yeoman to GitHub pages
我无法将我的 yeoman angular 应用程序部署到 GitHub 页面。
我使用的是 deploy yeoman 教程:
- 从 .gitignore 文件中删除 dist 目录。 Yeoman 项目默认忽略它。
- 将 dist 目录添加到您的存储库:
git add dist && git commit -m "Initial dist subtree commit"
- 将子树部署到不同的分支。使用 --prefix:
git subtree push --prefix dist origin gh-pages
指定 dist 目录的相对路径
但是我的 GitHub 页面仍在使用来自 branch master 的代码。例如 http://derk153.github.io/app/index.html 显示了一些数据,但 dist
分支没有显示 gh-pages
我认为您必须将 Angular 应用程序添加到分支 gh-pages 的新存储库中。
我推荐你这个东西:
- 创建一个新的存储库。
- 将您的代码移至此存储库中。
- 在 dist 文件夹中添加一个新的分支 gh-pages(就像 Yeoman 推荐的那样)。
- 您可以像这样使用 grunt 包:https://github.com/tschaub/grunt-gh-pages
检查我的例子:我有这个 repo 来为我的 github.io 主页添加代码:My main github.io repo. Then, I create a new repo with new code here. Check the gh-pages branch, the code is available here.
我无法将我的 yeoman angular 应用程序部署到 GitHub 页面。 我使用的是 deploy yeoman 教程:
- 从 .gitignore 文件中删除 dist 目录。 Yeoman 项目默认忽略它。
- 将 dist 目录添加到您的存储库:
git add dist && git commit -m "Initial dist subtree commit"
- 将子树部署到不同的分支。使用 --prefix:
git subtree push --prefix dist origin gh-pages
指定 dist 目录的相对路径
但是我的 GitHub 页面仍在使用来自 branch master 的代码。例如 http://derk153.github.io/app/index.html 显示了一些数据,但 dist
分支没有显示 gh-pages
我认为您必须将 Angular 应用程序添加到分支 gh-pages 的新存储库中。
我推荐你这个东西:
- 创建一个新的存储库。
- 将您的代码移至此存储库中。
- 在 dist 文件夹中添加一个新的分支 gh-pages(就像 Yeoman 推荐的那样)。
- 您可以像这样使用 grunt 包:https://github.com/tschaub/grunt-gh-pages
检查我的例子:我有这个 repo 来为我的 github.io 主页添加代码:My main github.io repo. Then, I create a new repo with new code here. Check the gh-pages branch, the code is available here.