angular我爱编程

部署angular应用到 Github

2018-06-11  本文已影响26人  王义杰

Deploy to GitHub Pages

部署到 Github

A simple way to deploy your Angular app is to use
GitHub Pages.
部署Angular应用的一个简单方法是使用GitHub Pages. 如果自己做一个单页网站可以不需要自购web服务器。

The first step is to create a GitHub account, and then
create a repository for your project.
Make a note of the user name and project name in GitHub.
第一步是创建一个GitHub帐户,然后为您的项目创建一个存储库 。记下GitHub中的用户名和项目名称。

Then all you need to do is run ng build --prod --output-path docs --base-href PROJECT_NAME, where
PROJECT_NAME is the name of your project in GitHub.
Make a copy of docs/index.html and name it docs/404.html.
然后你需要做的就是运行 ng build --prod --output-path docs --base-href PROJECT_NAME, PROJECT_NAME 是GitHub中项目的名称。复制 docs/index.html 并将其命名为 docs/404.html

Commit your changes and push. On the GitHub project page, configure it to
publish from the docs folder.
提交你的改变并推送到github。在GitHub项目页面上,将其配置为从docs文件夹发布

And that's all you need to do! Now you can see your page at
https://USER_NAME.github.io/PROJECT_NAME/.
这就是你需要做的一切!现在你可以看到你的网页了https://USER_NAME.github.io/PROJECT_NAME/.

You can also use angular-cli-ghpages, a full
featured package that does this all this for you and has extra functionality.

上一篇下一篇

猜你喜欢

热点阅读