99
1010The best place to learn is the [ guide] ( https://seed-rs.org ) - this readme is an excerpt from it.
1111
12- ## Quickstart
13-
1412## Setup
15- This framework requires you to first install [ Rust] ( https://www.rust-lang.org/tools/install ) .
13+ This framework requires you to install [ Rust] ( https://www.rust-lang.org/tools/install ) .
1614
1715You'll need a recent version of Rust: ` rustup update `
1816
@@ -41,22 +39,21 @@ If not using the quickstart repo, create an Html file with a body that contains
4139``` html
4240<section id =" main" ></section >
4341
44- <script src =' ./pkg/appname .js' ></script >
42+ <script src =' ./pkg/package .js' ></script >
4543
4644<script >
4745 const { render } = wasm_bindgen;
4846 function run () {
4947 render ();
5048 }
51- wasm_bindgen (' ./pkg/appname_bg .wasm' )
49+ wasm_bindgen (' ./pkg/package_bg .wasm' )
5250 .then (run)
5351 .catch (console .error );
5452 </script >
5553```
5654The first line above is an empty element with id: It's where your app will render. The subsequent ones load your app's wasm modules.
5755
58- The quickstart repo includes this file, but you will need to rename the two
59- occurances of ` appname ` . (If your project name has a hyphen, use an underscore instead here) You will eventually need to modify this file to
56+ The quickstart repo includes this file. You will eventually need to modify it to
6057change the page's title, add a description, favicon, stylesheet etc.
6158
6259` Cargo.toml ` , which is a file created by Cargo that describes your app, needs ` wasm-bindgen ` , ` web-sys ` , and `
@@ -75,7 +72,7 @@ edition = "2018"
7572crate-type = [" cdylib" ]
7673
7774[dependencies ]
78- seed = " ^0.2.0 "
75+ seed = " ^0.1.12 "
7976wasm-bindgen = " ^0.2.29"
8077web-sys = " ^0.3.6"
8178```
@@ -143,8 +140,7 @@ fn success_level(clicks: i32) -> El<Msg> {
143140 p! [ descrip ]
144141}
145142
146- /// The top-level component we pass to the virtual dom. Must accept the model as its
147- /// only parameter, and output a single El.
143+ /// The top-level component we pass to the virtual dom.
148144fn view (state : seed :: App <Msg , Model >, model : Model ) -> El <Msg > {
149145 let plural = if model . count == 1 {"" } else {" s" };
150146
@@ -195,7 +191,7 @@ cargo build --target wasm32-unknown-unknown
195191```
196192and
197193```
198- wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no modules --out-dir ./pkg
194+ wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no modules --out-dir ./pkg --out-name package
199195```
200196where ` appname ` is replaced with your app's name. This compiles your code in the target
201197folder, and populates the pkg folder with your WASM module, a Typescript definitions file,
@@ -212,6 +208,8 @@ For development, you can view your app using a shimmed Python dev server, as des
212208from the quickstart repo, and run ` python serve.py ` ).
213209
214210In the future, the build script and commands above may be replaced by [ wasm-pack] ( https://github.com/rustwasm/wasm-pack ) .
211+ You may use it now if you wish, but may run into issues running the examples, enabling no-modules mode,
212+ and syntax-highlighting in the compile logs.
215213
216214## Running included examples
217215To run an example located in the [ examples folder] ( https://github.com/David-OConnor/seed/tree/master/examples ) ,
0 commit comments