Front End Engineering, May 2015

Deploying an Ember.js app to GitHub Pages

  • In config/environment.js, for environment === 'production',

    1. Set locationType to hash
    2. ensure that ENV.baseURL is equal to the name of your project on GitHub. E.g., for the repo http://github.com/jacobthemyth/cool-project, my environment would look like:
    if (environment === 'production') {
      ENV.locationType = 'hash';
      ENV.baseURL = '/cool-project/';
    }
    
  • $ ember build --environment=production --output-path=gh-dist

  • $ git add gh-dist
  • $ git commit -m "Deploy to gh-pages"
  • $ if [ -n "$(git ls-remote origin gh-pages)" ]; then; git push origin :gh-pages; fi
  • $ git subtree push --prefix=gh-dist origin gh-pages
  • $ git reset --hard HEAD^