possible to change where github pages looks for in

2019-04-09 03:54发布

I have a site generated with yeoman's generator-angular and I'd like to publish this site using github pages. I create the gh-pages branch but my repo does not show up in myusername.github.io/myreponame I think the reason is because index.html is in the app/ directory not the root.

app/ |-- index.html |-- scripts/ dist/ Gruntfile.js etc..

Can I tell github pages to load index.html from the app folder? How can I launch a site generated w/ angular-generator to gh pages?

2条回答
▲ chillily
2楼-- · 2019-04-09 04:07

Running grunt build is important as without it dist directory is not created. Also changes will appear on gh-pages only after they are added and pushed to the subtree.

  1. Remove dist from .gitignore file
  2. Run grunt build in console
  3. After the project is built the dist directory needs to be added to the GitHub. Run this command in console: git add dist && git commit -m "Initial dist subtree commit"
  4. And then push the subtree to the gh-pages branch: git subtree push --prefix dist origin gh-pages
查看更多
狗以群分
3楼-- · 2019-04-09 04:31

All of your answers can be found here!

In a nutshell, you will generate the deployment-ready version of your site. You do this by running grunt. That will generate the optimized, production site in a folder called dist. You will then push the contents of dist directly to gh-pages.

A frequent contributor to Yeoman also made this task: grunt-build-control, which will let you simply run something like grunt deploy.

查看更多
登录 后发表回答