assets

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package assets serves embedded files with configurable caching and gzip compression.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptsGzip

func AcceptsGzip(value string) bool

AcceptsGzip reports whether Accept-Encoding permits gzip (or an eligible wildcard).

func Static

func Static(config StaticConfig) http.Handler

Static serves embedded files with immutable asset caching and negotiated gzip.

Types

type StaticConfig

type StaticConfig struct {
	// Files is a filesystem rooted at the public asset directory.
	Files fs.FS
	// ImmutablePrefix marks fingerprinted build assets, for example /assets/.
	ImmutablePrefix string
	// NoCacheFiles are asset paths whose content must be revalidated.
	NoCacheFiles []string
	// MinCompressSize is the minimum size for gzip, defaulting to 1024 bytes.
	MinCompressSize int
}

StaticConfig configures a read-only embedded file server.

Jump to

Keyboard shortcuts

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