golazy.dev golazy.dev / lazyassets Index | Files

package lazyassets

import "golazy.dev/lazyassets"

Package lazyassets registers, fingerprints, and serves application assets.

Types

type Asset

type Asset struct {
	Path		string	`json:"path"`
	Permanent	string	`json:"permanent,omitempty"`
	ContentType	string	`json:"content_type,omitempty"`
	Size		int64	`json:"size"`
	Hash		string	`json:"hash,omitempty"`
	ETag		string	`json:"etag,omitempty"`
	Integrity	string	`json:"integrity,omitempty"`
	Source		string	`json:"source,omitempty"`
	Generated	bool	`json:"generated,omitempty"`
	Ignored		bool	`json:"ignored,omitempty"`
	// contains filtered or unexported fields
}
func (a *Asset) Open
func (a *Asset) Open() (io.ReadCloser, error)

type Registry

type Registry struct {
	// contains filtered or unexported fields
}
func New
func New(options ...Option) *Registry
func (r *Registry) Add
func (r *Registry) Add(path string, content []byte, options ...AssetOption) error
func (r *Registry) AddFS
func (r *Registry) AddFS(files fs.FS, options ...SourceOption) error
func (r *Registry) AddReader
func (r *Registry) AddReader(path string, open OpenFunc, options ...AssetOption) error
func (r *Registry) Empty
func (r *Registry) Empty() bool
func (r *Registry) Handler
func (r *Registry) Handler(next http.Handler) http.Handler
func (r *Registry) Helpers
func (r *Registry) Helpers() map[string]any
func (r *Registry) Integrity
func (r *Registry) Integrity(assetPath string) (string, error)
func (r *Registry) Manifest
func (r *Registry) Manifest() Manifest
func (r *Registry) MustPath
func (r *Registry) MustPath(assetPath string) string
func (r *Registry) Path
func (r *Registry) Path(assetPath string) (string, error)
func (r *Registry) ServeHTTP
func (r *Registry) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (r *Registry) Unpack
func (r *Registry) Unpack(dir string, options ...UnpackOption) error