Use this guide to deploy Ember apps based on our Ember Template to GitHub Pages.
By the end of this, developers should be able to:
npm install
and bower install
.ember-template
->
<% NAME OF YOUR CLIENT %>
). (Search via command+shift+f
)config/environment.js
to follow below:-Note that if you do not see the apiHost line, you will need to add it now as seen below.
module.exports = function(environment) {
var ENV = {
modulePrefix: '<% NAME OF YOUR CLIENT will be here %>',
environment: environment,
rootURL: '/',
locationType: 'auto',
apiHost: 'http://localhost:3000/',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
Yes, user var
for ENV
. Do not use const
. Do not use let
.
AND FURTHER DOWN IN config/environment.js
:
if (environment === 'production') {
ENV.rootURL = '/<name-of-git-repo>';
ENV.locationType = 'hash';
ENV.apiHost = '<% replace with the URL to your deployed API %>';
}
ENV.rootURL = '/ember-deployment-guide'
-Note that rootURL
is NOT camelcase. For example, rootUrl
will not work.
adapters/application.js
and ajax
files
import the apiHost
link.In adapters/application.js
file:
import ActiveModelAdapter from 'active-model-adapter';
import ENV from '<% ember-deployment-example name %>/config/environment';
export default ActiveModelAdapter.extend({
host: ENV.apiHost,
...
...
...
});
IF/WHEN you have a services/ember-ajax
file:
import AjaxService from 'services/ember-ajax';
import ENV from '<% ember-deployment-example name %>/config/environment';
export default AjaxService.extend({
host: ENV.apiHost,
...
...
...
});
master
branch.gh-pages
branch locally via git checkout -b gh-pages
./dist
from .gitignore
by adding a '#' before it.git add dist/
)why?ember build --environment=production
.git status
and add all files changed (mainly dist/
) and some other changes; Then commit
all changes.git subtree push --prefix dist origin gh-pages
You just said remove, why am I adding again? This is because you just removed dist/
from the gitignore, which means that git is now aware of it and will track it if added. We want to track dist on the gh-pages branch, so we add and commit it here.