您的位置:首页 > 编程语言

使用angular-cli-ghpages部署Angular应用到GitHub

2017-10-16 23:07 573 查看
GitHub有一个很实用的功能就是GitHub Pages,他相当于为Github项目建立了一个可视化的web页面。
angular-cli-ghpages
的功能就与这个类似。

首先新建一个Github空项目,比如angular-deploy

然后使用angular-cli工具生成一个新项目

安装angular-cli-ghpages包

npm install angular-cli-ghpages -g


打包项目代码,并设置项目链接地址

ng build --prod --base-href "https://justforuse.github.io/angular-deploy/"


初始化git

git init
git remote add origin https://github.com/justforuse/angular-deploy.git[/code] 
发布(默认push到gh-pages分支上)

ngh


示例地址:https://github.com/justforuse/angular-deploy

参考连接:https://coursetro.com/posts/code/64/How-to-Deploy-an-Angular-App-(Angular-4)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: