Primary commands

div start

Serve your folder locally with live reload — no build step, no fuss.

div start

div start is your local development server. It serves the current folder over HTTP, watches for file changes, and live-reloads any browser tabs you've got open. Open the URL, edit your files, and the page refreshes itself like magic.

#Synopsis

div start [options]

#What it does

div start is a small local web server tuned specifically for websites. It serves files from the current directory, watches for changes, and tells connected browser tabs to reload whenever you save. There's no build step. There's no compile step. There's just files in, pixels out.

If index.html doesn't exist in the folder, div start will let you know and exit. The dev server isn't a directory browser — it expects an entry point, exactly like a deployed website does.

#Options

Flag What it does
-p, --port <port> Port to serve on. Default: 3000. Auto-increments if the port is busy.
-h, --host <host> Host to bind to. Default: 127.0.0.1.
--no-open Skip opening the browser.

#Examples

Serve the current folder on the default port:

div start

Serve on a specific port:

div start --port 8080

Serve without opening a browser tab (great when you've already got one):

div start --no-open

Bind to all interfaces so your phone on the same wifi can hit your laptop:

div start --host 0.0.0.0

Same heads-up as in div new before binding to 0.0.0.0 — only do this when you actually want to share.

#How live reload works

The dev server quietly injects a small <script> tag right before </body> in every HTML response. That script opens a WebSocket back to the dev server. When a file changes on disk, the server broadcasts a reload signal, and every connected tab calls location.reload(). File-change events get debounced briefly so a flurry of saves doesn't trigger a stampede of reloads.

The injection only touches the response sent to the browser — your HTML on disk stays exactly as you wrote it.

#Stopping

Ctrl+C shuts down the server cleanly. Easy.

#See also

  • div new — scaffolds a project and runs div start for you.
  • div deploy — when you're ready to ship.