/webview-yew-minimal

a minimal example of webview-yew app

Primary LanguageJavaScriptMIT LicenseMIT

webview-yew-minimal

a minimal example of webview-yew app (with Monty Python quotes)

Setup

  1. clone the project
  2. run this terminal command to build: make process build.
  3. run this terminal command to run the app: make clean process run. The clean portion of the command can be left out if there are no stale files to clean up in /static.

The Makefile is a convenience, because the Yew frontend must be built with cargo web build --release, while the Webview backend with just cargo build or cargo run. See the Makefile for details.

Setting Up Your Project

  • Be sure to look at inline_code.rs, particularly the definition for const YEW_WASM_LOADER on line 52. This string needs to match the portion of the JS file generated by Yew precisely, including whitespace. In addition, the file names within it will be based on the name of your Yew project, as defined in your Cargo.toml. Those portions will need to be manually replaced.
  • As this is a minimal example, there is no code sharing between the frontend and backend. It is easy to create obscure errors, by changing the CustomEvent key in either layer, for example. For a more complex example that utilizes a shared middle layer to mitigate this coupling, see my Rocksalt project.