diff --git a/examples/ball_spawner/README.md b/examples/ball_spawner/README.md index 3e47f91..f34a4a1 100644 --- a/examples/ball_spawner/README.md +++ b/examples/ball_spawner/README.md @@ -2,14 +2,14 @@ Simple example of using the library to create a ball spawner. Balls are spawned on click at the clicked location with a random direction and color. -### Bundling the app +## Bundling the app This example uses [esgleam](https://hexdocs.pm/esgleam/) to bundle the main gleam module for use in a static site. To install esbuild run the following command. You should only need to run it once. ```bash -gleam run -m esgleam/bundle +gleam run -m esgleam/install ``` To bundle the app run the following command after making code changes. @@ -18,7 +18,7 @@ To bundle the app run the following command after making code changes. gleam run -m esgleam/bundle ``` -### Serving the app +## Serving the app You can use any static site server to host the app but for development you can continue to use esgleam by running diff --git a/examples/ball_spawner/src/ball_spawner.gleam b/examples/ball_spawner/src/ball_spawner.gleam index 83d2d14..849fcd6 100644 --- a/examples/ball_spawner/src/ball_spawner.gleam +++ b/examples/ball_spawner/src/ball_spawner.gleam @@ -1,9 +1,9 @@ -import p5js_gleam.{type P5, SketchConfig} -import p5js_gleam/bindings as p5 -import gleam/option import gleam/float import gleam/io import gleam/list +import gleam/option +import p5js_gleam.{type P5, SketchConfig} +import p5js_gleam/bindings as p5 type Vector { Vector(x: Float, y: Float) diff --git a/examples/minimal/README.md b/examples/minimal/README.md index d45c3d1..102fb67 100644 --- a/examples/minimal/README.md +++ b/examples/minimal/README.md @@ -1,25 +1,27 @@ # minimal -[![Package Version](https://img.shields.io/hexpm/v/minimal)](https://hex.pm/packages/minimal) -[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/minimal/) +Bare minimum example rendering a hello message to the screen. -```sh -gleam add minimal +## Bundling the app + +This example uses [esgleam](https://hexdocs.pm/esgleam/) to bundle the main gleam module for use in a static site. + +To install esbuild run the following command. You should only need to run it once. + +```bash +gleam run -m esgleam/install ``` -```gleam -import minimal -pub fn main() { - // TODO: An example of the project in use -} +To bundle the app run the following command after making code changes. + +```bash +gleam run -m esgleam/bundle ``` -Further documentation can be found at . +## Serving the app -## Development +You can use any static site server to host the app but for development you can continue to use esgleam by running -```sh -gleam run # Run the project -gleam test # Run the tests -gleam shell # Run an Erlang shell +```bash +gleam run -m esgleam/serve ``` diff --git a/examples/minimal/src/minimal.gleam b/examples/minimal/src/minimal.gleam index 2e0f7f6..f92e4bd 100644 --- a/examples/minimal/src/minimal.gleam +++ b/examples/minimal/src/minimal.gleam @@ -1,6 +1,6 @@ +import gleam/option import p5js_gleam.{type P5, SketchConfig} import p5js_gleam/bindings as p5 -import gleam/option fn setup(p: P5) -> String { p5.create_canvas(p, 800.0, 600.0)