Create Yew App Save

Set up a modern Yew web app by running one command.

Project README

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

Install Trunk.

Creating 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.

Open Source Agenda is not affiliated with "Create Yew App" Project. README Source: jetli/create-yew-app
Stars
161
Open Issues
3
Last Commit
1 month ago
License

Open Source Agenda Badge

Open Source Agenda Rating