Requirements:
Weave is designed with simplicity in mind, you only need two files to get started.
deps.ednsrc/app/core.cljCreate a file called deps.edn,
{:paths ["src"]
:deps {org.clojure/clojure {:mvn/version "1.12.0"}
weave/core {:git/url "https://github.com/nakkaya/weave/"
:git/sha "<<latest-commit-sha>>"}}
:aliases {:dev {:exec-fn app.core/run}}}
Then in src/app/core.clj
(ns app.core
(:require [weave.core :as weave]))
(defn view []
[:div.p-6
[:h1#label.text-2xl.font-bold "Hello Weave!"]
[:button.bg-blue-500.text-white.px-4.py-2.rounded
{:data-on-click
(weave/handler []
(weave/push-html!
[:h1#label.text-2xl.font-bold "Button was clicked!"]))}
"CLICK ME"]])
(defn run [_opts]
(weave/run #'view {}))
Run clj -X:dev to start the app on http://localhost:8080
Weave uses Chassis DSL for defining HTML elements in Clojure.
[:div "content"][:div.my-class "content"][:h1#title "Hello"][:button {:disabled true} "Click"][:div.p-4.bg-blue-500 "Styled content"]Weave uses Datastar on the client side for its reactive event handling system:
:data-on-click / :data-on-load / etc.weave/handler macro creates server-side event handlerspush-html! or broadcast-html!. By default,
Datastar merges fragments using Idiomorph,
which matches top level elements based on their IDview function defines your initial UI stateCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |