min

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectedExt added in v0.0.20

func ExpectedExt(srcPath string) string

ExpectedExt is the extension ProcessImage will write for src — the single answer the whole pipeline asks, so that "is this output current?" and "is this output an orphan?" cannot disagree with what the encoder actually produces. Treating both extensions as equally valid is what let a lossless .webp written by an older release survive next to the .jpg that replaced it: each variant appeared up to date because SOME file matched, and cleanup spared the stale one because SOME asset could have claimed it.

A JPEG source needs no decode: the format has no alpha channel, so it is opaque by construction. Anything else has to be read. An unreadable source returns "", meaning "unknown" — callers then fall back to accepting either extension rather than deleting output they cannot reason about.

func IsUpToDate

func IsUpToDate(srcPath string, variants image.Variant, outputDir string) bool

func IsVector added in v0.0.21

func IsVector(srcPath string) bool

IsVector responde si la fuente se entrega tal cual en vez de codificarse.

Existe porque un logo vectorial no tiene dónde vivir en un pipeline que solo sabía convertir mapas de bits: quedaba fuera de image.Asset y cada sitio se escribía su propio copiador de archivos. Ese copiador era invisible para el demonio, así que el mismo proyecto servía el logo en release y devolvía 404 en desarrollo.

func ProcessImage

func ProcessImage(src ParsedAsset, outputDir string, quality int, log func(...any)) ([]string, error)

func VectorOutputName added in v0.0.21

func VectorOutputName(srcPath string) string

VectorOutputName es el nombre con el que un vector aterriza en la salida: el suyo, sin sufijo de variante. La página lo referencia por ese nombre.

Types

type Config

type Config struct {
	RootDir   string
	OutputDir string
	Quality   int
}

type Handler

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

func New

func New(c *Config) *Handler

func (*Handler) LoadImages

func (h *Handler) LoadImages() error

LoadImages discovers modules via go list and processes their images.

func (*Handler) Logger

func (h *Handler) Logger(messages ...any)

func (*Handler) Name

func (h *Handler) Name() string

func (*Handler) ReloadModule

func (h *Handler) ReloadModule(moduleDir string) error

ReloadModule re-extracts and re-processes images for a single module.

func (*Handler) SetFinder added in v0.0.6

func (h *Handler) SetFinder(f *modfind.Finder)

func (*Handler) SetLog

func (h *Handler) SetLog(fn func(messages ...any))

func (*Handler) UnobservedFiles

func (h *Handler) UnobservedFiles() []string

type ParsedAsset

type ParsedAsset struct {
	AbsPath  string        // absolute path: moduleDir + "/" + asset.Path
	Variants image.Variant // resolved bitmask value
	Alt      string
	BaseName string // base name without extension: "logo", "hero"
}

func ExtractImages

func ExtractImages(moduleDir string) ([]ParsedAsset, error)

Jump to

Keyboard shortcuts

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