go.static: github.com/daaku/go.static Index | Files

package static

import "github.com/daaku/go.static"

Package static provides go.h compatible hashed static asset URIs. This allows for providing long lived cache headers for resources which change URLs as their content changes.

TODO - actually dont cache in memory when disabled - defer reading files - gzip support + caching of gzipped data - css processor for handling url() - css minification - js minification - css sprites - support referencing http urls

Index

Package Files

static.go

type Handler

type Handler struct {
    sync.RWMutex
    HttpPath    string        // prefix path for static files
    MaxAge      time.Duration // max-age for HTTP headers
    MemoryCache bool          // enable in memory cache
    DiskPath    string        // path on disk to serve
    // contains filtered or unexported fields
}

func HandlerFlag

func HandlerFlag(name string) *Handler

func (*Handler) CombinedURL

func (h *Handler) CombinedURL(names []string) (string, error)

Get a hashed combined URL for all named files.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Serves the static resource.

func (*Handler) URL

func (h *Handler) URL(name string) (string, error)

Get a hashed URL for a single file.

type Img

type Img struct {
    ID      string
    Class   string
    Style   string
    Src     string
    Alt     string
    Handler *Handler
    // contains filtered or unexported fields
}

func (*Img) HTML

func (i *Img) HTML() (h.HTML, error)

type LinkStyle

type LinkStyle struct {
    HREF    []string
    Handler *Handler
    // contains filtered or unexported fields
}

func (*LinkStyle) HTML

func (l *LinkStyle) HTML() (h.HTML, error)

type Script

type Script struct {
    Src     []string
    Async   bool
    Handler *Handler
    // contains filtered or unexported fields
}

func (*Script) HTML

func (l *Script) HTML() (h.HTML, error)

func (*Script) Script

func (l *Script) Script() string

For github.com/daaku/go.h.js.loader compatibility.

func (*Script) URLs

func (l *Script) URLs() []string

For github.com/daaku/go.h.js.loader compatibility.

Package static imports 12 packages (graph) and is imported by 8 packages. Updated 2013-09-27. Refresh now. Tools for package owners.