Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WatchFilesystem ¶
func WatchFilesystem(ctx context.Context, opt WatchOptions) error
Types ¶
type WatchOptions ¶
type WatchOptions struct {
// RunOnStart indicates whether to run the function on start.
RunOnStart bool
// Name is the name of this watcher.
// It is used for logging/debugging purposes.
Name string
// Dir is the directory to watch files from.
Dir string
// IncludeFiles is a list of files relative to Dir to watch.
IncludeFiles []string
// IncludeSuffix is a list of file suffixes to watch.
// Format: ".ext", "_templ.go", etc.
IncludeSuffix []string
// ExcludeSuffix is a list of file suffixes to exclude.
// Format: ".ext", "_templ.go", etc.
ExcludeSuffix []string
// Fn is the function to call when a file is modified.
Fn func([]string)
// Batch is the time to wait before sending a batch of changed files.
// This avoids sending multiple events if a tool (like Templ) modifies
// multiple files at once. It is better to batch them together.
Batch time.Duration
}
Click to show internal directories.
Click to hide internal directories.