Documentation
¶
Overview ¶
Package preview runs the live-preview HTTP server: serves the SPA, an iframe-hosted paged.js view of the document, pushes a reload signal over WebSocket on file changes, and exposes /print to trigger PDF generation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a single-client live-preview server bound to one source document.
func New ¶
New returns a server for the given document. The document is re-read from disk on every render so edits in any external editor are picked up.
func (*Server) CurrentThemePath ¶
CurrentThemePath returns the resolved theme path of the current document. Used by callers to wire up a file watcher on it.
func (*Server) PushReload ¶
PushReload notifies the connected client that the underlying document or theme changed and the iframe should be reloaded.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches a set of files and invokes onChange (debounced) when any of them is written.
func NewWatcher ¶
NewWatcher creates a watcher and adds each given path. Missing paths are skipped with a warning rather than treated as fatal — themes may be inlined into the document, in which case there's nothing to watch.