Skip to content

Deploying to github pages with custom domain is not working correctly #4127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TautvydasDerzinskas opened this issue Jan 20, 2017 · 5 comments

Comments

@TautvydasDerzinskas
Copy link

Please provide us with the following information:
When deploying Angular-cli application it uses repository name to define a base path. This is an issue when you deploy application to Github repository witch has custom domain enabled for it's Github pages.

You still need to define repository name to get app deployed but in such case you wouldn't want to have that name as absolute path of your application.

""
in index.html should become
"<base href="{{ REPOSITORY NAME or "/" if custom domain is enabled }}">"

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
All OS

Versions.

angular-cli: 1.0.0-beta.25.5
node: 7.3.0
os: win32 x64

Repro steps.

  1. Have a repository where Github pages setup uses custom domain
  2. Deploy your app (app must contain components)
  3. Test it

The log given by the failure.

Application tries to load component files using such link structure:

{{ Custom domain}}/{{ Repository name }}/{{ Rest of the path to the component files }}
(I did bold out the problematic part)

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

@MrGrigri
Copy link

I too am having this same issue. It appears to me that it needs to maintain the <base href="/"> tag instead of trying to inject the repository name. Maybe this could be accomplished in the angular-cli.json file in a `githubPages" object where you could customize the CNAME location and href value.

@jevenson
Copy link

jevenson commented Jan 22, 2017

The CLI could check for the presence of a CNAME file in the repository, and when one is detected, do not modify the base tag.

UPDATE:
I'm looking at this file here, and it looks like there is an option. Trying to figure out how to use it at the moment.
github-pages-deploy.run.ts

SOLUTION:
Using Beta 26, I found that running this command will resolve the issue:
ng github-pages:deploy --custom-domain customdomain.com

I'm not sure if there is a way to configure the custom domain in the angular-cli.json file, but if there isn't a way, there should be. Right now I have the above script in an npm script.

Additionally, after updating to Beta 26 I had to remove my local gh-pages branch because it wasn't connected to the origin branch anymore for some reason.

@MrGrigri
Copy link

I can confirm that it works with angular-cli version 1.0.0-beta.26. I still believe that there should be a better way. GitHub looks at the CNAME file, why can't the CLI?

@filipesilva
Copy link
Contributor

Fixed by #3392. Sorry it wasn't well documented, we're going through the docs and fixing these gaps nowadays.

@MrGrigri that PR actually creates the CNAME file. You might have one in your project, or you might not.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants