diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..a9f1242 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +run-wasm = ["run", "--release", "--package", "run-wasm", "--"] diff --git a/Cargo.toml b/Cargo.toml index 56c8020..60be900 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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", +] diff --git a/README.md b/README.md index 1c901cd..f15cb6e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/run-wasm/Cargo.toml b/run-wasm/Cargo.toml new file mode 100644 index 0000000..a6cf8b4 --- /dev/null +++ b/run-wasm/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "run-wasm" +version = "0.1.0" +edition = "2021" + +[dependencies] +cargo-run-wasm = "0.3.0" diff --git a/run-wasm/src/main.rs b/run-wasm/src/main.rs new file mode 100644 index 0000000..6961358 --- /dev/null +++ b/run-wasm/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + cargo_run_wasm::run_wasm_with_css("body { margin: 0px; }"); +}