html_of_jsx

html_of_jsx is an implementation of JSX designed to render HTML on the server, without React or anything else. It's a minimal library that allows you to write components of HTML in a declarative way.

Installation

opam pin add html_of_jsx git+https://github.com/davesnx/html_of_jsx
+ (library html_of_jsx.lib)
+ (preprocess (pps html_of_jsx.ppx))

Usage

let element = <a href="https://x.com/davesnx">
  <span> {"Click me!"} </span>
</a>

let html: string = Html_of_jsx.render(element);

Check the demo/server.re file to see a full example with a tiny HTTP server.

Documentation

Check the Documentation to know more about the API and the features.

Credits

This library is extracted from server-reason-react and simplified to just work with HTML5.