Create Yew App
Create Yew apps with no build configuration.
- Creating an App โ How to create a new app.
- Yew - Rust / Wasm framework for building client web apps.
- Awesome Yew - A curated list of awesome things related to Yew / WebAssembly.
Check out a live demo powered by Create Yew App.
Quick Overview
npx create-yew-app my-app
cd my-app
trunk serve
(npx comes with npm 5.2+ and higher, see instructions for older npm versions)
Then open http://localhost:8080/ to see your app.
When youโre ready to deploy to production, create a minified bundle with trunk build
.
Getting Started
Install Rust wasm target
rustup target add wasm32-unknown-unknown
Trunk.
InstallCreating an App
Youโll need to have Node 8.16.0 or Node 10.16.0 or later version on your local development machine (but itโs not required on the server). You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between different projects.
To create a new app, you may choose one of the following methods:
npx
npx create-yew-app my-app
(npx is a package runner tool that comes with npm 5.2+ and higher, see instructions for older npm versions)
npm
npm init yew-app my-app
npm init <initializer>
is available in npm 6+
Yarn
yarn create yew-app my-app
yarn create <starter-kit-package>
is available in Yarn 0.25+
Project structure
It will create a directory called my-app
inside the current folder.
Inside that directory, it will generate the initial project structure and install the transitive dependencies:
my-app
โโโ README.md
โโโ .gitignore
โโโ Cargo.toml
โโโ index.html
โโโ LICENSE-APACHE
โโโ LICENSE-MIT
โโโ tailwind.config.js
โโโ tailwind.css
โโโ Trunk.toml
โโโ public
โ โโโ favicon.ico
โ โโโ logo.svg
โโโ src
โโโ lib.rs
โโโ main.rs
โโโ app
โ โโโ about.rs
โ โโโ home.rs
โ โโโ mod.rs
โโโ components
โโโ nav.rs
โโโ mod.rs
No configuration or complicated folder structures, only the files you need to build your app.
Once the installation is done, you can open your project folder:
cd my-app
Inside the newly created project, you can run some built-in commands:
trunk serve
Runs the app in development mode.
Open http://localhost:8080 to view it in the browser.
The page will automatically reload if you make changes to the code.
You will see the build errors and lint warnings in the console.
trunk build
Builds the app for production to the dist
folder.
It correctly bundles Yew in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed.
wasm-pack test --headless --chrome
Runs the test watcher in an interactive mode.
By default, runs tests related to files changed since the last commit.
Contributing
Feel free to take a look at the current issues in this repo for anything that currently needs to be worked on.
You are also welcome to open a PR or a new issue if you see something is missing or could be improved upon.
License
Apache License (Version 2.0)
See LICENSE for details.