部署angular应用到 Github

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.

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,438评论 0 10
  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    网事_79a3阅读 12,260评论 3 20
  • l姓名:刘永聪 公司:新阳学院/深圳塾 30期努力1组 学员、54期乐观2组 志工、57期反省1组 志工、72期乐...
    srlyc阅读 357评论 0 0
  • 从明天起, 我要善待每一个人。 让每一个冰窖, 响起快乐的歌谣。 就算暴风雨来到, 人们也吹着口哨。 从明天起, ...
    爱昧世间阅读 474评论 2 2
  • 大学时值得怀念的时光,便是时不时都会爆发一些灵感,写点自己满意的字,每次写完,心情都会变得更好,然后期待着朋友们的...