blogin serve

Build the site and serve it locally, rebuilding when anything under the site directory changes. blogin.json is read once at startup, so an edit to it takes effect when you restart the server. A successful rebuild live-reloads the open page in the browser.

blogin serve [--src <dir>] [--port <n>] [--verbose]

Options#

-s, --src <dir>
the content directory. It defaults to content.
-p, --port <n>
the port to listen on. It defaults to 3000.
-v, --verbose
prints a line per request.

Every option also has a one-letter spelling, listed on blogin build.

Example#

blogin serve --port 4000

The server binds loopback only, so it is reachable from the machine it runs on and nowhere else. minify and fingerprint are off while serving, whatever blogin.json says. Drafts and future-dated posts are left out of a preview, and serve has no option to include them.

Where it builds#

A preview is built into .blogin-preview/, not the output directory in blogin.json. Serving a site therefore never writes the directory you deploy, so a preview cannot leave unminified, unfingerprinted assets where a deploy would pick them up. The preview keeps its own build state, so a preview and a release never read each other's.

Add .blogin-preview/ to .gitignore. blogin clean removes it along with the output directory. See Previewing and Building.