devserver

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package devserver runs a local HTTP preview of the digest HTML templates with browser live-reload. It renders the digest/swipe/archive views from a fixed digest, re-reading templates from disk on every request, and pushes a reload to connected browsers whenever a *.tmpl file under the templates directory changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export added in v0.4.0

func Export(opts Options, dir string) error

Export renders the same page set Run serves into dir as static HTML and returns, without starting an HTTP server. Files use the bare filenames the pages link to, so relative links between them resolve when opened from disk. Pages are self-contained (inline CSS/JS) except the archive index and swipe page, which fetch manifest.json client-side; serve dir over HTTP to view those.

func Run

func Run(opts Options) error

Run starts the preview server and blocks until the process is interrupted or the HTTP server fails.

Types

type Options

type Options struct {
	Addr         string          // listen address, e.g. ":8099"
	TemplatesDir string          // directory holding *.tmpl files, watched for changes
	AssetsDir    string          // directory of Vite-built assets (*.css/*.js), read on disk and watched
	OpenBrowser  bool            // open the default browser at startup
	Digests      []models.Digest // digests listed in the archive and served individually
	Feeds        []models.Feed   // feeds listed on the sources page (empty for the sample fixture)
	Layout       string          // template layout name; empty = default
}

Options configures the dev preview server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL