These 3 packages work well together, but each can be used without the others.
- @jvlk/rescript-htmx - Very light bindings to use HTMX props with JSX. Planning on adding bindings for the JS client side of things soon.
- @jvlk/rescript-lite-jsx - Bindings for lite-jsx, a super light weight JSX to string library. Props for HTMX are included.
- @jvlk/rescript-dream - A light weight web framework inspired by OCaml’s Dream that can support different JS runtimes and server frameworks. Currently supports Express and Bun.
let router = Dream.router([
Dream.get("/", async _ => {
Dream.html(
<html>
<head>
<script src="https://unpkg.com/htmx.org@1.9.12" />
</head>
<button hxGet="/data" hxTarget="#data"> {Lite.string("Get data")} </button>
<div id="data" />
</html>,
)
}),
Dream.get("/data", async _ => {
Dream.html(<div> {"Data!"->Lite.string} </div>)
}),
])
// You can also use DreamExpress.run
let _ = DreamBun.run(router->Dream.logger)
Pull requests are desired! I’m hoping libraries like these can be used as a starting point for larger efforts, like @zth’s res-x.