How to deploy an Angular 7 application to GitHub Pages


Set gh-pages to be the brach to build from in repo settings:

🌹  git checkout -b gh-pages
🌹  git push origin gh-pages
🌹  npm install -g angular-cli-ghpages
🌹  ng build --prod --base-href https://[username][repo]/
🌹  ngh 

It is only necessary to set the the--base-href flag once, next time you build the project you can simply run:

🌹  ng build --prod

In order to compile images correctly use path as following: