Pardeep Jain
Pardeep Jain

Reputation: 86740

angular2 file path mismatch while publishing code on github pages

I'm trying to publish my angular2 todo app using github pages, i have followed all steps given in the documentation of github pages, choose theme, choose folder i.e dist after all configuration i got error of files missing here like this

enter image description here

any help to publish my app would be appriciated. here is repo's link

https://github.com/PardeepJain/Mean

and link is

https://pardeepjain.github.io/Mean/dist/

Update

I want to publish my code like this repo

https://moyummy.github.io/ng2-lite/

Upvotes: 0

Views: 56

Answers (2)

Amee Prajapati
Amee Prajapati

Reputation: 696

while building your app include . as your base href

i.e

ng build --base-href .

Then push to github.

Upvotes: 2

Rahul Singh
Rahul Singh

Reputation: 19622

1 -- If you want the application to run on the root directory - create a special repo with the name [yourgithubusername].github.io and opush these files in the master branch

2 -- Where as if you want to create these page in the sub directory of in a different brach other than than the root , create a branch gh-pages and push these files in that branch.

In both the cases the way we access these deployed pages will be different .

For the First Case it will be https://[yourgithubusername].github.io and for the second case it will be [yourgithubusername].github.io/[Repo name].

If Suppose you want to deploy it using the second case make sure to change the base url pf the index.html file in the dist as all the route mappings depend on the path you give and it should be set to [/branchname].

A working example of the Same - https://rahulrsingh09.github.io/AngularConcepts

and https://rahulrsingh09.github.io/Deployment/

check this for reference - https://github.com/rahulrsingh09/Deployment

Upvotes: 1

Related Questions