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

Add --bundle option to build/run web commands #68

Open
TimJentzsch opened this issue Sep 14, 2024 · 1 comment · May be fixed by #195
Open

Add --bundle option to build/run web commands #68

TimJentzsch opened this issue Sep 14, 2024 · 1 comment · May be fixed by #195
Assignees
Labels
A-Build Related to the bevy build command A-Run Related to the bevy run command A-Web Building or running Bevy apps targeting the browser

Comments

@TimJentzsch
Copy link
Collaborator

The --bundle PATH option would create a new folder at PATH and put all web-related artifacts in that folder.

This includes the WASM and JS bindgen, a copy of the assets folder and the index.html file.

The idea is that only this folder has to be served to run the entire app.

@janhohenheim
Copy link
Member

That would be really really nice :) Additional features could include running wasm-opt on it by default and maybe gzip optionally.

@TimJentzsch TimJentzsch mentioned this issue Sep 24, 2024
TimJentzsch added a commit that referenced this issue Sep 29, 2024
This PR adds the remaining pieces needed for the `bevy build` command.

The command is a wrapper around `cargo build`, but with an additional
`web` sub command which makes it a lot easier to build an app for the
browser.
I also plan to add additional features in the feature, like #68.

The PR contains the following changes:

- Added `cargo install` wrapper to install a program if it's missing
(prompting the user).
- Added helper to obtain the current package name via `Cargo.toml`.
There are likely better ways to do this (perhaps via `cargo metadata`),
but I already had this implemented and we can improve it in a follow-up
if needed.
- Added helper to determine the active compilation profile, which is
needed to determine the path to the build artifact.
- Implemented the build command itself.
@TimJentzsch TimJentzsch added A-Run Related to the bevy run command A-Build Related to the bevy build command labels Oct 6, 2024
@TimJentzsch TimJentzsch added the A-Web Building or running Bevy apps targeting the browser label Dec 3, 2024
@TimJentzsch TimJentzsch self-assigned this Dec 22, 2024
@TimJentzsch TimJentzsch linked a pull request Dec 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Build Related to the bevy build command A-Run Related to the bevy run command A-Web Building or running Bevy apps targeting the browser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants