Skip to content

sn99/wasm-template-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wasm template for Rust hosting without npm-deploy on github pages using Travis script

Featured on This Week in Rust 327

Last updated: 29th-September-2023

Build Status

It automatically hosts you wasm projects on gh-pages using a travis script on the latest commit.

Requirements

Steps :

For building :

  "dependencies": {
    "wasm-template-rust": "file:../pkg"
  },

Into :

  "dependencies": {
    "YOUR-PROJECT-NAME-SAME-AS-IN-CARGO.toml": "file:../pkg"
  },
  • Run wasm-pack build inside your project dictionary
  • Run npm install inside www folder
  • Next, modify www/index.js to import your PROJECT instead of the wasm-template-rust package
  • Again run npm install inside www folder (just to be sure)
  • Finally run npm run start inside www and visit http://localhost:8080 to see the results

For deployment :

The template comes with a preconfigured .travis.yml but you will still need to :

  • Create a new branch by the name gh-pages
  • Github pages should be enabled by default but if not go to Settings -> GitHub Pages and enable it on your gh-pages branch. You will also find the link to your to-be hosted page there
  • Make a personal access token (only the token no need for command line here)
  • Next we will need to put this token into our travis settings, go to more options -> settings -> Environment Variables and enter the token value (the generated token code) and name as GITHUB_TOKEN, it should look like : token

Additional :

License

Licensed under either of these:

About

A wasm 🕸 template for Rust 🦀 to publish to gh-pages without npm-deploy

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published