Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top