From f8b915a03f6182e01d45072f3d3b13a22052f2ac Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Sun, 11 Aug 2019 21:06:11 -0700 Subject: [PATCH 01/20] Create Cargo.toml --- Cargo.toml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Cargo.toml diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..9a39684 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,18 @@ +[package] +authors = ["Kelly Thomas Kline "] +categories = ["gui", "wasm", "web-programming"] +description = "yew-wasm-pack-minimal shows the minimum code and tooling necessary for a frontend web app using Yew, wasm-bindgen, and wasm-pack." +edition = "2018" +keywords = ["yew", "wasm", "wasm-bindgen", "web"] +license = "MIT/Apache-2.0" +name = "yew-wasm-pack-minimal" +readme = "README.md" +repository = "https://github.com/yewstack/yew-wasm-pack-minimal" +version = "0.1.0" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = "^0.2" +yew = "0.8" From d7f7e62791016135570689a8447cfe42a022998d Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Sun, 11 Aug 2019 21:17:52 -0700 Subject: [PATCH 02/20] Create README.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..29861fd --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +## About + +This template demonstrates the minimum code and tooling necessary for a frontend web app using [`Yew`](https://github.com/yewstack/yew), [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen), and [`wasm-pack`](https://github.com/rustwasm/wasm-pack). + +Note: [`yew-wasm-pack-template`](https://github.com/yewstack/yew-wasm-pack-template) is the full-featured counterpart to this template, integrating many common web technologies. + +## Usage + +### 1) Install `wasm-pack` + +Follow the `installation` link at [`wasm-pack`](https://github.com/rustwasm/wasm-pack). + +### 2) Build + +Enter `wasm-pack build --target web` from your project's root directory. + +### 3) [optional] Test Run + +Run a webserver from your project's root directory, such as with `python -m SimpleHTTPServer 8080`, to view the results. + +### 4) Deploy + +Access your generated build artifacts in ./pkg from your project's root directory. From c23cd24b8e66777741d32870bda60b0f2becf2ad Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Sun, 11 Aug 2019 21:18:31 -0700 Subject: [PATCH 03/20] Create LICENSE-MIT --- LICENSE-MIT | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 LICENSE-MIT diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..9cfb930 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2019 {{authors}} + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. From ac955fcff429cdc63f9e48912e6793bb3a666ac3 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Sun, 11 Aug 2019 21:19:19 -0700 Subject: [PATCH 04/20] Create LICENSE-APACHE --- LICENSE-APACHE | 176 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 LICENSE-APACHE diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..1b5ec8b --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,176 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS From 4424a2880fcc2c0aeaa5b2deb72ee5dc683326f0 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Sun, 11 Aug 2019 21:20:06 -0700 Subject: [PATCH 05/20] Create index.html --- index.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..78961f9 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + Yew + + + + + + + From df7969297e5a7282c051a7bdd98b813b18b59857 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Sun, 11 Aug 2019 21:21:20 -0700 Subject: [PATCH 06/20] Create lib.rs --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/lib.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..0c9c58d --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,10 @@ +mod app; + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn run_app() -> Result<(), JsValue> { + yew::start_app::(); + + Ok(()) +} From 2cdf5567974b789273a87e42a5e7ba9828b37cc4 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Sun, 11 Aug 2019 21:21:37 -0700 Subject: [PATCH 07/20] Create app.rs --- src/app.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/app.rs diff --git a/src/app.rs b/src/app.rs new file mode 100644 index 0000000..143436b --- /dev/null +++ b/src/app.rs @@ -0,0 +1,26 @@ +use yew::prelude::*; + +pub struct App {} + +pub enum Msg {} + +impl Component for App { + type Message = Msg; + type Properties = (); + + fn create(_: Self::Properties, _: ComponentLink) -> Self { + App {} + } + + fn update(&mut self, _msg: Self::Message) -> ShouldRender { + true + } +} + +impl Renderable for App { + fn view(&self) -> Html { + html! { +

{ "Hello world!" }

+ } + } +} From add7803fd5cf82edf02196ce43b7abd49f37e415 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Sun, 11 Aug 2019 21:22:02 -0700 Subject: [PATCH 08/20] Create rustfmt.toml --- rustfmt.toml | 1 + 1 file changed, 1 insertion(+) create mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..32a9786 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +edition = "2018" From 4223c8574c732e5c75ac3445299c2457de08ac8c Mon Sep 17 00:00:00 2001 From: Samuel Rounce Date: Mon, 12 Aug 2019 08:16:52 +0100 Subject: [PATCH 09/20] Fixed entrypoint --- index.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 78961f9..ab7d72e 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,14 @@ - + From a36da4e7bf1d3e50de41d1fe5de12c8d89ebde85 Mon Sep 17 00:00:00 2001 From: Samuel Rounce Date: Thu, 15 Aug 2019 01:34:30 +0100 Subject: [PATCH 10/20] `index.html` now uses `main.js` as entry-point Removed entry-point shim code from `index.html` and moved it into `main.js` --- index.html | 11 ++--------- main.js | 6 ++++++ 2 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 main.js diff --git a/index.html b/index.html index ab7d72e..1f7593f 100644 --- a/index.html +++ b/index.html @@ -4,17 +4,10 @@ Yew + - - + \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..d35e64b --- /dev/null +++ b/main.js @@ -0,0 +1,6 @@ +import init, { run_app } from './pkg/yew_wasm_pack_minimal.js'; +async function main() { + await init('/pkg/yew_wasm_pack_minimal_bg.wasm'); + run_app(); +} +main() \ No newline at end of file From 7993c2669780041371b4ea44f561bd1b4c81cf43 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:03:57 -0700 Subject: [PATCH 11/20] Update README.md --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 29861fd..174a2af 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,29 @@ ## About -This template demonstrates the minimum code and tooling necessary for a frontend web app using [`Yew`](https://github.com/yewstack/yew), [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen), and [`wasm-pack`](https://github.com/rustwasm/wasm-pack). +This template demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts of one HTML file, one JavaScript file, and one WASM file, using [`Yew`](https://github.com/yewstack/yew), [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen), and [`wasm-pack`](https://github.com/rustwasm/wasm-pack). Note: [`yew-wasm-pack-template`](https://github.com/yewstack/yew-wasm-pack-template) is the full-featured counterpart to this template, integrating many common web technologies. ## Usage -### 1) Install `wasm-pack` +### 1) Install `Rust` and `wasm-pack` -Follow the `installation` link at [`wasm-pack`](https://github.com/rustwasm/wasm-pack). +Follow the instructions at https://www.rust-lang.org/tools/install and follow the `installation` link at [`wasm-pack`](https://github.com/rustwasm/wasm-pack). ### 2) Build Enter `wasm-pack build --target web` from your project's root directory. -### 3) [optional] Test Run +### 3) [temporary] Bundle + +Enter `rollup ./main.js --format iife --file ./pkg/bundle.js` from your project's root directory. + +Note: Until `wasm-pack` [RFC #6](https://github.com/rustwasm/rfcs/blob/master/text/006-local-js-dependencies.md) is implemented, there is no available option to [generate a single amalgamated JavaScript file](https://github.com/rustwasm/wasm-pack/issues/699). In the interim, a bundler such as [`Rollup`](https://rollupjs.org/guide/en/#quick-start), must be used. + +### 4) [optional] Test Run Run a webserver from your project's root directory, such as with `python -m SimpleHTTPServer 8080`, to view the results. -### 4) Deploy +### 5) Deploy -Access your generated build artifacts in ./pkg from your project's root directory. +Access your generated build artifacts, `bundle.js` and `yew_wasm_pack_minimal_bg.wasm`, in ./pkg from your project's root directory. From 788c52a36a81df37294beb89f965d90f8b078c64 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:05:59 -0700 Subject: [PATCH 12/20] Update Cargo.toml --- Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9a39684..064b4ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,8 @@ [package] -authors = ["Kelly Thomas Kline "] +authors = [ + "Kelly Thomas Kline ", + "Samuel Rounce " +] categories = ["gui", "wasm", "web-programming"] description = "yew-wasm-pack-minimal shows the minimum code and tooling necessary for a frontend web app using Yew, wasm-bindgen, and wasm-pack." edition = "2018" From 7fe9eb7f3bd94ccd633cd05b2e1c8033fbad26c7 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:08:33 -0700 Subject: [PATCH 13/20] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 064b4ea..f9456fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ authors = [ "Samuel Rounce " ] categories = ["gui", "wasm", "web-programming"] -description = "yew-wasm-pack-minimal shows the minimum code and tooling necessary for a frontend web app using Yew, wasm-bindgen, and wasm-pack." +description = "yew-wasm-pack-minimal demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts consisting of one HTML file, one JavaScript file, and one WASM file, using Yew, wasm-bindgen, and wasm-pack." edition = "2018" keywords = ["yew", "wasm", "wasm-bindgen", "web"] license = "MIT/Apache-2.0" From 66023ce343bbbf72fe646d33a6d27c8264b278f3 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:08:54 -0700 Subject: [PATCH 14/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 174a2af..58974db 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## About -This template demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts of one HTML file, one JavaScript file, and one WASM file, using [`Yew`](https://github.com/yewstack/yew), [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen), and [`wasm-pack`](https://github.com/rustwasm/wasm-pack). +This template demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts consisting of one HTML file, one JavaScript file, and one WASM file, using [`Yew`](https://github.com/yewstack/yew), [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen), and [`wasm-pack`](https://github.com/rustwasm/wasm-pack). Note: [`yew-wasm-pack-template`](https://github.com/yewstack/yew-wasm-pack-template) is the full-featured counterpart to this template, integrating many common web technologies. From 874e8dbe4e25f532b348cef6997597cb05333904 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:09:41 -0700 Subject: [PATCH 15/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58974db..5f359a7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## About -This template demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts consisting of one HTML file, one JavaScript file, and one WASM file, using [`Yew`](https://github.com/yewstack/yew), [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen), and [`wasm-pack`](https://github.com/rustwasm/wasm-pack). +This template demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts consisting of one HTML file, one JavaScript file, and one WebAssembly file, using [`Yew`](https://github.com/yewstack/yew), [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen), and [`wasm-pack`](https://github.com/rustwasm/wasm-pack). Note: [`yew-wasm-pack-template`](https://github.com/yewstack/yew-wasm-pack-template) is the full-featured counterpart to this template, integrating many common web technologies. From 9a049ca56541d38f860a8f3c4e56a922e2884448 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:10:05 -0700 Subject: [PATCH 16/20] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f9456fb..fb75783 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ authors = [ "Samuel Rounce " ] categories = ["gui", "wasm", "web-programming"] -description = "yew-wasm-pack-minimal demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts consisting of one HTML file, one JavaScript file, and one WASM file, using Yew, wasm-bindgen, and wasm-pack." +description = "yew-wasm-pack-minimal demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts consisting of one HTML file, one JavaScript file, and one WebAssembly file, using Yew, wasm-bindgen, and wasm-pack." edition = "2018" keywords = ["yew", "wasm", "wasm-bindgen", "web"] license = "MIT/Apache-2.0" From edd493d74fe83a1c6c2b43319b940a84aabd3634 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:31:58 -0700 Subject: [PATCH 17/20] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f359a7..a215e31 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,9 @@ Note: Until `wasm-pack` [RFC #6](https://github.com/rustwasm/rfcs/blob/master/te ### 4) [optional] Test Run -Run a webserver from your project's root directory, such as with `python -m SimpleHTTPServer 8080`, to view the results. +Run a webserver from your project's root directory, such as with `python -m SimpleHTTPServer 8080`, and load http://localhost:8080/ in a browser to view the running app. + +Note: It's expected behavior for the browser console to display an error similar to "WebAssembly.instantiateStreaming failed. Assuming this is because your server does not serve wasm with application/wasm MIME type." Your production webserver should be configured to associate wasm files with the application/wasm MIME type. ### 5) Deploy From aacda3b6048b07b475e78f53e701aad56ac234e7 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:34:00 -0700 Subject: [PATCH 18/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a215e31..03a768b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Note: Until `wasm-pack` [RFC #6](https://github.com/rustwasm/rfcs/blob/master/te Run a webserver from your project's root directory, such as with `python -m SimpleHTTPServer 8080`, and load http://localhost:8080/ in a browser to view the running app. -Note: It's expected behavior for the browser console to display an error similar to "WebAssembly.instantiateStreaming failed. Assuming this is because your server does not serve wasm with application/wasm MIME type." Your production webserver should be configured to associate wasm files with the application/wasm MIME type. +Note: It's expected behavior for the browser console to display an error similar to "WebAssembly.instantiateStreaming failed. Assuming this is because your server does not serve wasm with application/wasm MIME type." Your production webserver should be configured to associate WebAssembly files with the `application/wasm` MIME type. ### 5) Deploy From 7c2458fe1792fd1670553209c820647d87292690 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 18:34:38 -0700 Subject: [PATCH 19/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03a768b..8063542 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Note: Until `wasm-pack` [RFC #6](https://github.com/rustwasm/rfcs/blob/master/te ### 4) [optional] Test Run -Run a webserver from your project's root directory, such as with `python -m SimpleHTTPServer 8080`, and load http://localhost:8080/ in a browser to view the running app. +Run a webserver from your project's root directory, such as with `python -m SimpleHTTPServer 8080`, and load http://localhost:8080/ in a browser to run the app. Note: It's expected behavior for the browser console to display an error similar to "WebAssembly.instantiateStreaming failed. Assuming this is because your server does not serve wasm with application/wasm MIME type." Your production webserver should be configured to associate WebAssembly files with the `application/wasm` MIME type. From 97b62e0a928a5e644768790465b9d2fc11b4c0d1 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Kline Date: Wed, 14 Aug 2019 19:53:17 -0700 Subject: [PATCH 20/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8063542..fc7b8db 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Enter `wasm-pack build --target web` from your project's root directory. Enter `rollup ./main.js --format iife --file ./pkg/bundle.js` from your project's root directory. -Note: Until `wasm-pack` [RFC #6](https://github.com/rustwasm/rfcs/blob/master/text/006-local-js-dependencies.md) is implemented, there is no available option to [generate a single amalgamated JavaScript file](https://github.com/rustwasm/wasm-pack/issues/699). In the interim, a bundler such as [`Rollup`](https://rollupjs.org/guide/en/#quick-start), must be used. +Note: Until `wasm-pack` [RFC #6](https://github.com/rustwasm/rfcs/blob/master/text/006-local-js-dependencies.md) is implemented there is no available option to [generate a single amalgamated JavaScript file](https://github.com/rustwasm/wasm-pack/issues/699). In the interim a bundler, such as [`Rollup`](https://rollupjs.org/guide/en/#quick-start), must be used. ### 4) [optional] Test Run