Sharing Top Content from the Angular-sphere.

AngularJS & Github pages, the easy way. – Frontend Weekly – Medium

“ #Angular & #Github pages, the easy way.” by Rabbi Shuki Gur

  • Create a new sub-branch on GitHub.Since this branch doesn’t need all the master files (only the dist folder) we can use git subtree.git subtree push –prefix dist origin gh-pagesThis command translate to “create a sub-tree from my master in the folder dist, and call this new branch gh-pages”.
  • htaccess files, and you need a way to tell GitHub to pass the navigation over to angular.Luckily, there is a very simple trick.
  • Just rename your index.html to 404.html, and since GitHub will load that page, and AngularJS doesn’t care what the name of the page is, you have a fully functional website.3.
  • Pushing updates to the branch.Pushing future updates is as simple as using the same command again:git subtree push –prefix dist origin gh-pagesBut if for some reason, it doesn’t seem to work for you, and git starts complaining with the following message: Working tree has modifications.
  • You can always just delete the branch and start over.git push origin –delete gh-pagesgit subtree push –prefix dist origin gh-pagesWan’t to see the final result?Check the GitHub Repo

A Short step by step guide to deploy your angularjs website to GitHub static pages.

And without further ado, here are the steps to deploy your angularjs app to GitHub static pages.1. Create a new sub-branch on GitHub.Since this branch doesn’t need all the master files (only the dist folder) we can use git subtree.git subtree push –prefix dist origin gh-pagesThis command translate to “create a sub-tree from my master in the folder dist, and call this new branch gh-pages”. Exactly what we need.2. Remove the hash-bang.If you removed the hash-bang in your website, you might run in to some trouble, since GitHub doesn’t allow .htaccess files, and you need a way to tell GitHub to pass the navigation over to angular.Luckily, there is a very simple trick. Just rename your index.html to 404.html, and since GitHub will load that page, and AngularJS doesn’t care what the name of the page is, you have a fully functional website.3. Pushing updates to the branch.Pushing future updates is as simple as using the same command again:git subtree push –prefix dist origin gh-pagesBut if for some reason, it doesn’t seem to work for you, and git starts complaining with the following message: Working tree has modifications. Cannot add. You can always just delete the branch and start over.git push origin –delete gh-pagesgit subtree push –prefix dist origin gh-pagesWan’t to see the final result?Check the GitHub Repo

AngularJS & Github pages, the easy way. – Frontend Weekly – Medium

Comments are closed, but trackbacks and pingbacks are open.