From 640e3354fffd9f05306ca728c5d8c4a73bd76353 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Sat, 21 May 2022 04:15:12 +0100 Subject: :rocket: Deploy docs to GitHub Pages./mybackend -o test.s test.cl --- docs/index.html | 331 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 331 insertions(+) create mode 100644 docs/index.html (limited to 'docs/index.html') diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..e21d25a --- /dev/null +++ b/docs/index.html @@ -0,0 +1,331 @@ + + + + + + lustre + + + + + + + + + + + + +
+ + +
+ +

Lustre

+
+

A framework for building create web apps – powered by Gleam and React!

+
+

Package Version +Hex Docs

+
import gleam/int
+import lustre
+import lustre/element.{ button, div, p, text }
+import lustre/event.{ dispatch, on_click }
+
+pub fn main () {
+    let app = lustre.application(0, update, render)
+    lustre.start(app, "#app")
+}
+
+type Action {
+    Incr
+    Decr
+}
+
+fn update (state, action) {
+    case action {
+        Incr -> state + 1
+        Decr -> state - 1
+    }
+}
+
+fn render (state) {
+    div([], [
+        button([ on_click(dispatch(Decr)) ], [ text("-") ]),
+        p([], [ text(int.to_string(state)) ]),
+        button([ on_click(dispatch(Incr)) ], [ text("+") ])
+    ])
+}
+
+
+

❗️ This package relies on Gleam’s JavaScript FFI and will not work if your are +targeting Erlang.

+
+
+

Installation

+

If available on Hex, this package can be added to your Gleam project:

+
gleam add lustre
+
+

and its documentation can be found at https://hexdocs.pm/eval. You will also +need to install react and react-dom from npm:

+
npm i react react-dom
+
+
+

Development

+

First, make sure you have both Gleam and Node.js installed, then:

+
npm i
+npm start
+
+

This sets up chokidar to watch our gleam source code and runs the compiler +whenever we make a change. It also starts a server that will serve the examples +located in test/examples/.

+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3