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

Create a GitHub pages site with the bevy_ggrs example #244

Closed
wants to merge 6 commits into from

Conversation

garryod
Copy link
Collaborator

@garryod garryod commented Jul 1, 2023

Resolves #212

Code largely borrowed from bevy-shell-template

@garryod
Copy link
Collaborator Author

garryod commented Jul 1, 2023

For some reason I don't seem to be able to get the bevy app to mount to my canvas, resulting in the following error:

panicked at 'Cannot find element: #bevy_ggrs_example.'

This is despite the canvas being given this id. Any ideas @simbleau?

@garryod garryod force-pushed the pages-website branch 3 times, most recently from f5d126e to 63d2abd Compare July 1, 2023 22:06
@garryod garryod force-pushed the pages-website branch 3 times, most recently from 080a7ef to 4370405 Compare July 1, 2023 22:13
@simbleau
Copy link
Collaborator

simbleau commented Jul 7, 2023

panicked at 'Cannot find element: #bevy_ggrs_example.

I think this was an issue where either trunk or bevy updated and things broke. I stopped maintaining bevy-shell-template immediately after releasing it (as it was more-of an experiment for me). I can help look into this when I have some time soon-

@simbleau
Copy link
Collaborator

simbleau commented Aug 4, 2023

Sorry it took so long. Got it fixed. Check the commit. I basically just told Bevy to make the canvas and I triggered a resize manually to ensure it resizes itself.

image

@simbleau
Copy link
Collaborator

simbleau commented Aug 9, 2023

@garryod

@garryod
Copy link
Collaborator Author

garryod commented Aug 9, 2023

Sorry it took so long. Got it fixed. Check the commit. I basically just told Bevy to make the canvas and I triggered a resize manually to ensure it resizes itself.

Oooh, nice one! Does this mean attaching to a canvas is currently broken in Bevy?

@garryod garryod marked this pull request as ready for review August 9, 2023 20:01
@simbleau
Copy link
Collaborator

simbleau commented Aug 9, 2023

Sorry it took so long. Got it fixed. Check the commit. I basically just told Bevy to make the canvas and I triggered a resize manually to ensure it resizes itself.

Oooh, nice one! Does this mean attaching to a canvas is currently broken in Bevy?

I wouldn't say it's broken, that's a bit strong. Bevy will add the canvas and the resize listener (if fit_canvas_to_parent is true), but it won't immediately stretch to fit. That's why I had to fire the resize event manually. I think Bevy should do this, but I wouldn't call it broken.

@johanhelsing
Copy link
Owner

I'm a bit out of the loop (and new to trunk and yew).

Why can't we use canvas: None anymore and let Bevy create the canvas? It used to work before?

@garryod
Copy link
Collaborator Author

garryod commented Aug 15, 2023

Think this should now work with some configuration in the GitHub pages settings for the repo. @johanhelsing would you happy to have a go at this?

</div>

}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does yew give us, compared to just vanilla css in index.html?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, nothing. I had been playing around with little landing page that allowed you to choose a "room" to pass to the app but stripped it back to be basics to try get it working. If we want to do something like that It'd be worth keeping, but if not then simple is preferable

@johanhelsing
Copy link
Owner

I set the repo's Pages source to github actions, should that be enough?

Thanks for working on this :)

@johanhelsing
Copy link
Owner

Maybe it needs to be on a branch in this repo for it to deploy properly?

@garryod
Copy link
Collaborator Author

garryod commented Aug 19, 2023

I set the repo's Pages source to github actions, should that be enough?

Looks like the environment protection rules are preventing it, iirc there is an option for which branches can push to an environment in the settings

Branch "pages-website" is not allowed to deploy to github-pages due to environment protection rules

Maybe it needs to be on a branch in this repo for it to deploy properly?

Potentially, it may not be possible to relax the protection rules to allow pushing from forks

@simbleau
Copy link
Collaborator

Yew+Styling just provide a way to insert CSS stylesheets at runtime and replace the DOM .

#[styled_component(Root)]
fn root() -> Html {
global_style!(
r#"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the strings are actually not necessary. The global_style! and css! macros understand CSS as a DSL; Strings are usually used here for the same reasons as format!(), because it allows variable substitution.

@johanhelsing
Copy link
Owner

Should we perhaps get rid of yew, if it doesn't add anything?

We can always add it later if we have a use case for it...

@simbleau
Copy link
Collaborator

simbleau commented Sep 5, 2023

If the intention is to have a more grandiose website for the project like https://trunkrs.dev/, I think we should keep Yew. If it's just a blank page with a canvas, I'm all for the removal.

Yew tends to keep things cleaner when sites get complex, but not necessarily for a small application.

@johanhelsing
Copy link
Owner

Potentially, it may not be possible to relax the protection rules to allow pushing from forks

I'll try pushing to a branch in this repo, then. Would be nice to get this merged!

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

Successfully merging this pull request may close these issues.

Build and publish example projects in CI
3 participants