server

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLiveReloadInjector

func NewLiveReloadInjector(w io.Writer) io.Writer

NewLiveReloadInjector returns a writer that injects the LiveReload client into its wrapped content.

Types

type Server

type Server struct {
	Site *site.Site
	// contains filtered or unexported fields
}

Server serves the site on HTTP.

func (*Server) Run

func (s *Server) Run(open bool, logger func(label, value string)) error

Run starts a server on the address configured for the site.

func (*Server) Serve added in v1.9.0

func (s *Server) Serve(listener net.Listener) error

Serve serves the site and its watch-mode LiveReload endpoints on listener. Closing listener stops the HTTP server and releases all LiveReload connections.

type TagInjector

type TagInjector struct {
	// contains filtered or unexported fields
}

TagInjector wraps a writer and adds a script tag to its content. It depends on the fact that dynamic page rendering makes a single Write call, so that it's guaranteed to find the marker within a single invocation argument. It doesn't parse HTML, so it could be spoofed but probably only intentionally.

func (TagInjector) Write

func (i TagInjector) Write(b []byte) (n int, err error)

Write injects a livereload script tag at the end of the HTML head, if present, else at the beginning of the document.

Jump to

Keyboard shortcuts

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