server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2017 License: MIT Imports: 14 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 {
	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.

func (*Server) StartLiveReloader

func (s *Server) StartLiveReloader() error

StartLiveReloader starts the Live Reload server as a go routine, and returns immediately

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