How to set up a site using Angular 2 on Github pages

After the Angular 2 Quickstart tutorial , I created my site and want to work on GitHub Pages. However, I am currently running it with a command npm startin the terminal. What changes should I make so that it boots correctly after I click on Github?

+4
source share
1 answer

In my humble opinion, Angular2 Quick Start is a pain in but. Not quite fast!

I suggest you start using the Angular2 CLI (command line tool). It is fast, easy to use, has a built-in build process .. you get a dist .. folder, etc. Only benefits.

The build process is important here because if you want to host your application on GitHub using gh pages, you can only do this with one command:

ng github-pages:deploy 

But this is the recommended way. In your case, here it is different.

Following the quick start guide, you don’t have a build process, so instead you can push the whole angular2 -quickstart folder to the git repository on the gh-pages branch.

First: Install git, create a github account and github repository.

-: CMD - , angular2-quickstart :

git init --> your local, angular2-quickstart folder, becomes a git repository.

git commit -am "messaage: this stuff goes on master branch.."

git remote add origin <your GitHub repository url here> --> this will add the remote url, where you can push and pull.

git push origin master --> your hole folder will be available on GitHub on the master branch

GitHub

git checkout -b gh-pages  -> this creates a new branch called gh-pages based of master, and moves you to it.

git commit -am "your commit message" - you must have at least one commit in order to push.

git push origin gh-pages -> this will push the hole gh-pages branch from local repo - to the GitHub repo and hosting servers.

gh-pages URL-: http://your-github-username.imtqy.com/your-repository-name/. , .

, - , - , , .. , ! !

+3

Source: https://habr.com/ru/post/1652738/


All Articles