Skip to content
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

gh-pages project route not matching #76

Closed
JRJurman opened this issue Jan 19, 2017 · 5 comments
Closed

gh-pages project route not matching #76

JRJurman opened this issue Jan 19, 2017 · 5 comments

Comments

@JRJurman
Copy link

JRJurman commented Jan 19, 2017

I'm building an app with choo, and my router looks like this:

app.router([
  ['/', main],
]);

This works great when running locally or doing development, but when I push this to github pages, the project lives in a route off my github, http://jrjurman.github.io/project-name/, and I get an error that project-name/ is not a matching route.

I am able to use the default parameter to get a single route app working, but it doesn't solve the issue if there are multiple routes.

Is there a defined way to solve this?

@brechtcs
Copy link

Haven't been able to test it yet, but I think setting a baseUrl in your index.html should fix this:

<head>
    <base href="http://jrjurman.github.io/project-name/">
    <!-- other head stuff -->
</head>

@JRJurman
Copy link
Author

@brechtpm Just tried that, in the dev server it runs fine, but I still get the same error on gh-pages.

@yoshuawuyts
Copy link
Owner

yoshuawuyts commented Jan 20, 2017 via email

@brechtcs
Copy link

Apparently gh-pages doesn't support single-page apps out of the box. There are some extensive hacks out there to make it work though, so maybe you'd have some luck trying one of those.

@JRJurman
Copy link
Author

@yoshuawuyts that makes sense... I guess I could check what environment I'm building for, and prepend all the routes before sending it to sheet-router if I'm building for production. Currently, create-react-app looks for a homepage property in the package.json, which I now realize is probably how they solve this issue for their router.

@brechtpm that's an awesome find... It might be a little overkill for some of the projects I'm working on :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants