How do I deploy Ember.js app developed with ember-cli on github pages?

后端 未结 2 1510
故里飘歌
故里飘歌 2020-12-16 18:41

I have successfully created a small application using ember-cli. I tried pushing it to gh-pages branch of my github repo but it shows error in browser console



        
2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 18:55

    Since December 2014 there is also an ember-cli addon for this.

    First make sure to have set modulePrefix in config/environment.js to your repo's name on github. E.g., for https://github.com/username/my-cool-repo it should be modulePrefix: 'my-cool-repo'.

    Then follow these instructions:

    1. Install the addon.
      $ ember install:addon ember-cli-github-pages

    2. Commit the changes made by the addon.
      $ git add . && git commit -m "Installed addon ember-cli-github-pages"

    3. Create the gh-pages branch with only the necessary files.
      $ git checkout --orphan gh-pages && rm -rf `ls -a | grep -vE '.gitignore|.git|node_modules|bower_components|\.\/|\.\.\/'` && git add . && git commit -m "Initial gh-pages commit"

    4. Switch back to your source branch (most likely master).
      $ git checkout master

    5. Build your ember app to the gh-pages branch.
      $ ember gh-pages:commit --message "Initial gh-pages release"

    6. Push everything (or at least the gh-pages branch) to github.

    (This was different for ember-cli <= 0.1.4 and might change again in the future. Make sure to visit the addon's readme.)

提交回复
热议问题