[ANN] dream-html & pure-html 3.9.5

[ANN] dream-html & pure-html 3.9.5

Happy to announce that dream-html and pure-html 3.9.5 are now available on opam. This is a significant release with three main new things:

  1. Type-safe paths and routing
  2. Support for static asset caching
  3. HTML improvements

Type-safe paths and routing

Allows defining paths as values that can be handled by a router and also rendered by the HTML markup generator, so that the actual routed paths are in sync with the rendered paths in the application. These paths use OCaml’s built-in format strings rather than a new DSL: eg /orders/%s/versions/%d. This makes it possible to extract type-safe values from path segments and pass them to the handler; render markup with guaranteed correct paths; and refactor the app’s paths without having to hunt for hard-coded strings.

See the docs for details.

Static assets support

Automates the handling of static assets in the application so that they can easily be served by the router with an immutable cache policy and their paths can be rendered in markup with a content-based revision hash, for easy cache-busting.

Added a new CLI tool dreamwork which helps with scaffolding this static assets setup. The intention is to use it for more scaffolding tasks in the future–stay tuned.

See the docs for details, and this screen recording for a short demo.

HTML improvements

Thanks to RezwanArefin01 for prettifying the generated HTML. It is now formatted and much easier to read. See the snapshots for some examples.

Lastly, added HTML.as_ which is the as attribute.

Enjoy!

6 Likes