package dream-serve

  1. Overview
  2. Docs
Static site server with live reload

Install

Dune Dependency

Authors

Maintainers

Sources

1.0.0.tar.gz
sha256=77b3c31e5ce25fb93dba8a46a134098f0a5b4f4c064f1d605714002fe5f0156b
md5=f3e1ae3fc43fc623a778270a6fc93525

Description

dream-serve injects a small script into .html files, which reloads Web pages when they are updated in the file system.

Published: 11 Jun 2021

README

dream-serve

dream-serve is a very simple server for static sites. It reloads your browser when the site changes.



It's good for developing docs, streamlining coverage reports, and so forth. It works by injecting a script into HTML, which opens a WebSocket back to the server. The server uses the WebSocket to tell the browser when to reload.


Usage

Until dream-serve is released to opam and npm:

git clone https://github.com/aantron/dream-serve.git
cd dream-serve
_build/install/default/bin/dream-serve /my/site

After npm release:

npx dream-serve ./my/site

After opam release:

opam install dream-serve
dream-serve ./my/site

Based on

dream-serve is implemented as one small OCaml file. It is based on Web framework Dream, libuv binding Luv, and HTML rewriter Lambda Soup.

Special thanks to Ulrik Strid for writing the integration between Lwt and Luv/libuv that makes it possible to easily run Dream over libuv.


Roadmap

  • [ ] Factor out the client-handling and HTML-rewriting logic into a library that can be used with dynamic apps, so that they trigger a reload when coming back up.

Dependencies (6)

  1. lwt_ppx
  2. lwt >= "5.4.0"
  3. luv
  4. lambdasoup >= "0.6.1"
  5. dune >= "2.0.0"
  6. dream >= "1.0.0~alpha2" & < "1.0.0~alpha3"

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.