watchfs

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package watchfs is a ServerController that serves templates from a local directory and reloads when watched paths change. JSON type: "watchfs".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// Path is the templates directory. Default "templates".
	Path string `json:"path,omitempty" arg:"-t,--template-dir,--templates-dir" default:"templates"`

	// WatchDirs lists extra directories to watch (in addition to Path).
	WatchDirs []string `json:"watch_dirs,omitempty" arg:"--watch,separate"`

	// Debounce is the fs event debounce interval. Default 200ms.
	Debounce xtemplate.Duration `json:"debounce,omitempty" arg:"--debounce"`
	// contains filtered or unexported fields
}

Controller watches Path (and optional WatchDirs) and reloads on change.

func (*Controller) Init

func (s *Controller) Init(_ context.Context, log *slog.Logger) ([]xtemplate.Option, error)

Init returns the directory FS as sticky.

func (*Controller) Start

func (s *Controller) Start(server *xtemplate.Server) error

Start watches for changes and reloads from sticky. Stops when server.Context() is cancelled.

Directories

Path Synopsis
Package caddyfile registers the watchfs controller Caddyfile parser.
Package caddyfile registers the watchfs controller Caddyfile parser.

Jump to

Keyboard shortcuts

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