pork

package module
v0.0.0-...-0a935e8 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2017 License: MIT Imports: 20 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PathToClosureCompiler = "closure-compiler"

PathToClosureCompiler ...

View Source
var PathToJsx = "jsx"

PathToJsx ...

View Source
var PathToSass = "sass"

PathToSass ...

View Source
var PathToTsc = "tsc"

PathToTsc ...

Functions

func CompileJs

func CompileJs(c *Config, src, dst string) error

func CompileJsx

func CompileJsx(c *Config, src, dst string) error

func CompileScss

func CompileScss(c *Config, src, dst string) error

func CompileTsc

func CompileTsc(c *Config, src, dst string) error

func Root

func Root() string

Root ...

func ServeContent

func ServeContent(w ResponseWriter, r *http.Request, cfg *Config, d ...http.Dir)

ServeContent ...

func ServeContentModificationTime

func ServeContentModificationTime(w http.ResponseWriter, r *http.Request, t time.Time) bool

ServeContentModificationTime returns true if content should be delivered

Types

type Config

type Config struct {
	Level        Optimization
	JsxIncludes  []string
	JsxExterns   []string
	ScssIncludes []string
}

Config ...

func NewConfig

func NewConfig(level Optimization) *Config

NewConfig ...

type Handler

type Handler interface {
	Responder
	Productionize(d http.Dir) (func() error, error)
}

Handler ...

func Content

func Content(c *Config, d ...http.Dir) Handler

Content ...

type HostRedirectResponder

type HostRedirectResponder string

HostRedirectResponder ...

func (HostRedirectResponder) ServePork

func (h HostRedirectResponder) ServePork(w ResponseWriter, r *http.Request)

ServePork ...

type Optimization

type Optimization int

Optimization ...

const (
	// None ...
	None Optimization = iota

	// Basic ...
	Basic

	// Advanced ...
	Advanced
)

type Responder

type Responder interface {
	ServePork(ResponseWriter, *http.Request)
}

Responder ...

func ErrorFileResponder

func ErrorFileResponder(path string, status int) Responder

ErrorFileResponder ...

func FileResponder

func FileResponder(path string) Responder

FileResponder ...

func ResponderFor

func ResponderFor(h http.Handler) Responder

ResponderFor ...

func ResponderFunc

func ResponderFunc(f func(ResponseWriter, *http.Request)) Responder

ResponderFunc ...

type Response

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

Response ...

func FindContent

func FindContent(prefix string, r *http.Request, d ...http.Dir) (*Response, error)

FindContent ...

func (*Response) Deliver

func (r *Response) Deliver(cfg *Config, w ResponseWriter)

Deliver ...

type ResponseWriter

type ResponseWriter interface {
	http.ResponseWriter
	ServeNotFound()
	ServedFromPrefix() string
	EnableCompression()
}

ResponseWriter ...

type Router

type Router interface {
	RespondWith(string, Responder)
	RespondWithFunc(string, func(ResponseWriter, *http.Request))

	ServeHTTP(http.ResponseWriter, *http.Request)
}

Router ...

func NewRouter

func NewRouter(logger func(int, *http.Request), notFound Responder, headers map[string]string) Router

NewRouter ...

type Trie

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

func NewTrie

func NewTrie() *Trie

func (*Trie) Get

func (t *Trie) Get(key string) (string, interface{}, bool)

func (*Trie) Put

func (t *Trie) Put(prefix string, value interface{})

Directories

Path Synopsis
tools

Jump to

Keyboard shortcuts

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