You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.7 KiB

  1. <div align="center">
  2. <h1><code>wasm-pack-template</code></h1>
  3. <strong>A template for kick starting a Rust and WebAssembly project using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong>
  4. <p>
  5. <a href="https://travis-ci.org/rustwasm/wasm-pack-template"><img src="https://img.shields.io/travis/rustwasm/wasm-pack-template.svg?style=flat-square" alt="Build Status" /></a>
  6. </p>
  7. <h3>
  8. <a href="https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html">Tutorial</a>
  9. <span> | </span>
  10. <a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a>
  11. </h3>
  12. <sub>Built with 🦀🕸 by <a href="https://rustwasm.github.io/">The Rust and WebAssembly Working Group</a></sub>
  13. </div>
  14. ## About
  15. [**📚 Read this template tutorial! 📚**][template-docs]
  16. This template is designed for compiling Rust libraries into WebAssembly and
  17. publishing the resulting package to NPM.
  18. Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other
  19. templates and usages of `wasm-pack`.
  20. [tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html
  21. [template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html
  22. ## 🚴 Usage
  23. ### 🐑 Use `cargo generate` to Clone this Template
  24. [Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate)
  25. ```
  26. cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project
  27. cd my-project
  28. ```
  29. ### 🛠️ Build with `wasm-pack build`
  30. ```
  31. wasm-pack build
  32. ```
  33. ### 🔬 Test in Headless Browsers with `wasm-pack test`
  34. ```
  35. wasm-pack test --headless --firefox
  36. ```
  37. ### 🎁 Publish to NPM with `wasm-pack publish`
  38. ```
  39. wasm-pack publish
  40. ```
  41. ## 🔋 Batteries Included
  42. * [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating
  43. between WebAssembly and JavaScript.
  44. * [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook)
  45. for logging panic messages to the developer console.
  46. * [`wee_alloc`](https://github.com/rustwasm/wee_alloc), an allocator optimized
  47. for small code size.
  48. * `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you
  49. ## License
  50. Licensed under either of
  51. * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
  52. * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
  53. at your option.
  54. ### Contribution
  55. Unless you explicitly state otherwise, any contribution intentionally
  56. submitted for inclusion in the work by you, as defined in the Apache-2.0
  57. license, shall be dual licensed as above, without any additional terms or
  58. conditions.