[ANN] dream-html 3.0.0

[ANN] dream-html 3.4.1

Add ‘livereload’ support ie automatically reloading the page in the browser when the Dream server restarts. Useful to run with dune’s watch mode for a fast dev cycle.

This is adapted from Dream’s own livereload middleware but with a slightly different approach. Full details in the module documentation: Livereload (dream-html.Dream_html.Livereload)

Why reimplement this? It seems that Dream’s built-in livereload needs to parse the HTML markup, find its head tag, and dynamically inject the reloader script inside. Since parsing HTML can be pretty tricky and potentially buggy, I decided to manually add the script in the head tag as a strong-typed dream-html node:

head [] [
  ...
  Livereload.script;
  ...
]
3 Likes