Add run-wasm workspace member, as used in winit

This makes it easy to run examples with the web backend, in the same way
that winit examples are run.
This commit is contained in:
Ian Douglas Scott 2023-02-20 10:37:25 -08:00
parent 83c0f92dc5
commit 3b9976685c
5 changed files with 22 additions and 0 deletions

2
.cargo/config.toml Normal file
View file

@ -0,0 +1,2 @@
[alias]
run-wasm = ["run", "--release", "--package", "run-wasm", "--"]

View file

@ -72,3 +72,8 @@ features = ["jpeg"]
# Turn rayon back on everywhere else; creating the separate entry resets the features to default.
image = "0.23.14"
rayon = "1.5.1"
[workspace]
members = [
"run-wasm",
]

View file

@ -50,6 +50,11 @@ For now, the priority for new platforms is:
- Xcb ❌
- Xlib ✅
WebAssembly
-----------
To run an example with the web backend: `cargo run-wasm --example winit`
Example
==
```rust,no_run

7
run-wasm/Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "run-wasm"
version = "0.1.0"
edition = "2021"
[dependencies]
cargo-run-wasm = "0.3.0"

3
run-wasm/src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
cargo_run_wasm::run_wasm_with_css("body { margin: 0px; }");
}