Htmlact declares dynamic webpages by using HTML data attributes to seamlessly update the page with HTML fragments requested from the server.
Using HTML as the interaction substrate keeps logic on the server and, in the simplest cases, reduces front-end client code to custom CSS animations and an invocation of the Htmlact_page.init
function or adding the htmlact-page.js
script to your page.
See the quick start and the manual for the full details.
Htmlact was inspired by htmx.
The manual explains it all.
htmlact
That's not strictly needed. Only useful if you use Webs
and Htmlit
.
Htmlact
Htmlit
HTML generation and Webs
HTTP headers.htmlact.page
That's not srictly needed either. Only useful if you already js_of_ocaml
based front-end code and want to bundle the page driver with it. You can instead simply add the $(opam var
htmlact:share)/htmlact-page.js
script to your webpages
Htmlact_page
htmlact
webpage driver.If you really do not want to write a single line of front-end code, include the page $(opam var htmlact:share)/htmlact-page.js
in your page. Now the following:
<script type="text/javascript" defer src="htmlact-page.js"></script> <button data-request="POST /clicked" data-effect="element">Replace me</button>
instructs a click on the button to perform a POST request to /clicked
and replace the button with the HTML response. That's it.
If you installed htmlact
with tests (opam install -t htmlact
). The htamlact-examples
binary serves a few interaction examples and links to their sources.
The manual has all the details.
Htmlact
behaviour itself, this allows to chain Htmlact
connections in interesting ways and helps coordinating with other front end code. Update. Something was hastily added in Htmlact
.Ev. needs proper design and documentation.data-preserve
attribute which patches by id in the replacementdata-push-history
, pushes the request url, snapshots body element for state restoration.from:<sel>
).data-response-sel
to apply on the response.htmlact
use it.