Skip to content

Latest commit

 

History

History
58 lines (35 loc) · 1.09 KB

File metadata and controls

58 lines (35 loc) · 1.09 KB

dttp

A simple HTTP static dev server with live reloading.

Build

Use make:

$ make

Builds the binary to the ./out directory by default. Set variable DEST to change it:

$ DEST=bin make

Install

Use make:

$ make install

Installs in /usr/local by default. Set variable PREFIX to change it:

$ PREFIX=~/.local make install

Usage

dttp [-a ADDR] [-d DIR]
dttp [-a ADDR] -R

In the 1st form, start a static server listening at the address ADDR, serving files in DIR.

In the 2nd form, send a refresh event to all clients in an already listening server at address ADDR.

Live Reload

A live-reload script is served at /_/refresh.js. It does NOT watch for file changes. First, include the script at the end of your HTML files:

<!-- insert at the end of body -->
<script src="/_/refresh.js"></script>

Then, in your build or watch process, execute dttp -R:

$ make && dttp -R