Hc 9890fe7

Hc declares dynamic web pages by using HTML data attributes to seamlessly update the page with HTML fragments requested from the server.

Using hypertext 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 Hc_page.init function.

hc was inspired by htmx.

Quick start

If you really do not want to write a single line of front-end code, include the page $(opam var share)/hc/hc-page.js in your page. Now the following:

<script type="text/javascript" defer src="hc-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 hc with tests (opam install -t hc). The hc-examples binary serves a few interaction examples.