server

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 16 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 Live Reload JavaScript into its wrapped content.

Types

type Server

type Server struct {
	sync.Mutex
	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 runs the server.

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