Documentation
¶
Overview ¶
Package server implements the local development HTTP server with live reload.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WatchDirs = []string{"content", "themes", "assets"}
WatchDirs is the set of directories monitored for changes.
Functions ¶
This section is empty.
Types ¶
type DevServer ¶
type DevServer struct {
Host string
Port int
OutDir string
RootDir string // project root; WatchDirs are resolved relative to this when set
Watcher FileWatcher
RebuildFunc func() error // called on file change; may be nil
}
DevServer is a local HTTP development server with live reload.
func NewDevServer ¶
NewDevServer creates a new DevServer. rebuildFn is called when a watched file changes; pass nil to disable rebuild.
type FileWatcher ¶
FileWatcher is the file change detection interface. The implementation uses fsnotify.
type FsnotifyWatcher ¶
type FsnotifyWatcher struct {
// contains filtered or unexported fields
}
FsnotifyWatcher implements FileWatcher using github.com/fsnotify/fsnotify.
func NewFsnotifyWatcher ¶
func NewFsnotifyWatcher() (*FsnotifyWatcher, error)
NewFsnotifyWatcher creates and starts a new FsnotifyWatcher.
func (*FsnotifyWatcher) Add ¶
func (fw *FsnotifyWatcher) Add(path string) error
Add adds a path to be watched.
func (*FsnotifyWatcher) Events ¶
func (fw *FsnotifyWatcher) Events() <-chan string
Events returns the channel that receives changed file paths.
Click to show internal directories.
Click to hide internal directories.