GithubHelp home page GithubHelp logo

yewban's Introduction

Yewban

A simple frontend in Rust🦀️ for a goban (go game board).

Install

install the build tools

cargo install trunk wasm-bindgen-cli
  • Trunk is really amazing. At the time of writing it is recommended only in the non-stable version of the yew documentation. Trunk mentions that in the future, the wasm-bindgen-cli package will be installed as part of trunk.

install the rust wasm toolchain

rustup target add wasm32-unknown-unknown
  • Otherwise trunk build won't go through.

Development

Build

trunk build
  • This creates the /dist folder. Under the hood it also runs cargo build that creates the /target folder. So you can still normally use cargo's check, build or clippy for checking code.
  • Static files:

    The folder /static and its contents are copied via trunk automatically to /dist thanks to this line in index.html:
    "<link data-trunk rel="copy-dir" href="static"/>"

Build, view and rebuild code on the fly

trunk serve

Sharing the result

  • To cut the total size, get a clean output folder (if previous builds were made). This deletes the ./dist folder.

    trunk clean
    
  • Make a new optimized build.

    trunk build --release
    

If you want to run the html directly, for example on a different system, just launching index.html from ./dist/ won't work! If you need to use the index.html directly (for example in a link on your web), you have to change the 3 addresses for the .css, .js and .wasm inside. Otherwise by default it is searching for them in root.

But locally the simplest way is to serve the folder:

  • take the content of ./dist/ and serve it with any of these:
    • rust tool:

      miniserve ./dist --index index.html
      
    • npm (nodejs) tool:

      http-server ./dist
      
    • usually present by default on linux (run from inside the folder):

      python3 -m http.server
      

yewban's People

Contributors

janos-r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

rptst

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.