我关注了https://angular.io/guide/deployment中的文档并使用:
ng build --prod --output-path docs --base-href /<project_name>/
构建Angular项目,但在设置/源中找不到“ gh-pages分支”选项。
答案 0 :(得分:-1)
Setup:
1.You have an angular project.
2.Install angular-cli-ghpages package from npm like this
'npm install -g angular-cli-ghpages'
3. You can setup npm script like this or run directly in terminal:
"build-and-deploy-gh-pages": "ng build --prod --base-href ./ && npx ngh --dir dist/[reponame]"
Where ./ can be replaced with:
'https://[username].github.io/[reponame]/'
As a matter of fact, in above link you’ll find your github-page.
You’ll be asked for your github username and password to deploy to gihub pages.
This script will create gh-pages branch automatically and setup your repo for publishing online.
Next step would be to to run this script as: 'npm run build-and-deploy-gh-pages
我已经在Medium中撰写了一篇关于在github页面上部署angular的文章。
请看看here