如何在github页面上部署使用ember-cli开发的Ember.js应用程序? [英] How do I deploy Ember.js app developed with ember-cli on github pages?

查看:102
本文介绍了如何在github页面上部署使用ember-cli开发的Ember.js应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用ember-cli成功创建了一个小应用程序。我尝试将其推送到我的github repo的gh-pages分支,但它在浏览器控制台中显示错误

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

Uncaught ReferenceError: require is not defined 

dist / assets添加vendor.js和vendor.js文件也是失败的。

我无法在本地机器中的 dist 文件夹中运行独立的ember应用程序,同样的错误。

I'm not able to run standalone ember app from dist folder in local machine as well, same errors.

有人尝试过。

推荐答案

自2014年12月以来,还有一个 ember-cli addon为此

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

首先确保有将 config / environment.js 中的 modulePrefix 设置为您在github上的回购名称。例如,对于 https://github.com/username/my-cool-repo 应该是 modulePrefix:'my-cool-repo'

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. 安装插件。

    $ ember install:addon ember-cli-github-pages

提交插件的更改。

$ git add 。 &安培;&安培; git commit -minstalled addon ember-cli-github-pages

创建 gh-页面分支,只有必要的文件。

$ git checkout --orphan gh-pages&& rm -rf`ls -a | grep -vE'.gitignore | .git | node_modules | bower_components | \.\ / | \.\\ / /``&&& git add。 &安培;&安培; git commit -m初始gh页面提交

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"

切换回源分支(很可能 master )。

$ git checkout master

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

将您的Ember应用程序构建到 gh-pages 分支。

$ ember gh-页面:commit --message初始gh页面发布

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

推送所有内容(或至少 gh页面分支)到github。

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

(这是不同的对于ember-cli <= 0.1.4,并且将来可能会再次更改。请确保访问 addon的自述。)

这篇关于如何在github页面上部署使用ember-cli开发的Ember.js应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆