Changes in readme to reflect improved build script

master
DavidOConnor 6 years ago
parent 2a1f4d59b2
commit 8705283bb0

@ -10,10 +10,9 @@ crate-type = ["cdylib"]
[dependencies] [dependencies]
seed = "^0.2.1" seed = "^0.2.3"
wasm-bindgen = "^0.2.29" wasm-bindgen = "^0.2.33"
web-sys = "^0.3.6" web-sys = "^0.3.6"
# For serialization, eg sending requests to a server. Otherwise, not required. # For serialization, eg sending requests to a server. Otherwise, not required.
serde = { version = "^1.0.80", features = ['derive'] } serde = { version = "^1.0.85", features = ['derive'] }
serde_json = "^1.0.33"

@ -24,10 +24,8 @@ If you run into permission errors on `build.sh`, try this command
to allow executing the file:`chmod +x build.sh`. If you run into persmission errors on `build.ps1`, open Powershell as an administrator, and enter this command: `Set-ExecutionPolicy RemoteSigned`. to allow executing the file:`chmod +x build.sh`. If you run into persmission errors on `build.ps1`, open Powershell as an administrator, and enter this command: `Set-ExecutionPolicy RemoteSigned`.
Once you rename the crate in `Cargo.toml` (The `name` field under `[Package]`), make the Once you rename the crate in `Cargo.toml` (The `name` field under `[Package]`), make the
following changes: following change:
- Replace both occurances of `appname` (`/appname.js` and `/appname.wasm`) in `index.html` with your crate's name. - Replace `appname` with your new name in either `build.sh`, or `build.ps1`, depending on your
operating system.
- Make the same replacement in either `build.sh`, or `build.ps1`, depending on your
operating system. You may delete the other one.

@ -1,2 +1,2 @@
cargo build --target wasm32-unknown-unknown cargo build --target wasm32-unknown-unknown
wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg --out-name package

@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cargo build --target wasm32-unknown-unknown cargo build --target wasm32-unknown-unknown
wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg --out-name package

@ -16,7 +16,7 @@
<body> <body>
<section id="main"></section> <section id="main"></section>
<script src='./pkg/appname.js'></script> <script src='./pkg/package.js'></script>
<script> <script>
// the `wasm_bindgen` global is set to the exports of the Rust module // the `wasm_bindgen` global is set to the exports of the Rust module
@ -27,7 +27,7 @@
} }
// here we tell bindgen the path to the wasm file so it can run // here we tell bindgen the path to the wasm file so it can run
// initialization and return to us a promise when it's done // initialization and return to us a promise when it's done
wasm_bindgen('./pkg/appname_bg.wasm') wasm_bindgen('./pkg/package_bg.wasm')
.then(run) .then(run)
.catch(console.error); .catch(console.error);
</script> </script>

@ -35,7 +35,7 @@ fn update(msg: Msg, model: Model) -> Model {
// View // View
fn view(state: seed::App<Msg, Model>, model: Model) -> El<Msg> { fn view(_state: seed::App<Msg, Model>, model: Model) -> El<Msg> {
button![ button![
simple_ev("click", Msg::Increment), simple_ev("click", Msg::Increment),
format!("Hello, World × {}", model.val) format!("Hello, World × {}", model.val)

Loading…
Cancel
Save