Documentation
¶
Index ¶
- func ExpectedExt(srcPath string) string
- func IsUpToDate(srcPath string, variants image.Variant, outputDir string) bool
- func ProcessImage(src ParsedAsset, outputDir string, quality int, log func(...any)) ([]string, error)
- type Config
- type Handler
- func (h *Handler) LoadImages() error
- func (h *Handler) Logger(messages ...any)
- func (h *Handler) Name() string
- func (h *Handler) ReloadModule(moduleDir string) error
- func (h *Handler) SetFinder(f *modfind.Finder)
- func (h *Handler) SetLog(fn func(messages ...any))
- func (h *Handler) UnobservedFiles() []string
- type ParsedAsset
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectedExt ¶ added in v0.0.20
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 ProcessImage ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) LoadImages ¶
LoadImages discovers modules via go list and processes their images.
func (*Handler) ReloadModule ¶
ReloadModule re-extracts and re-processes images for a single module.
func (*Handler) UnobservedFiles ¶
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)