asset

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package asset contains utilities for serving static asset service like images, css, js, and other files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(stripPrefix string, root fs.FS) echo.HandlerFunc

Handler returns an echo.HandlerFunc that serves static files from the given fs.FS. The stripPrefix parameter is removed from the beginning of requested URLs before looking up files.

func Path

func Path(p string) string

Path appends a cache busting key to the given path URL. If a cache key is not set, it returns the original image path unchanged.

func SetCacheKey

func SetCacheKey(key string)

SetCacheKey sets a cache busting key that will be appended to asset URLs. A good cache key is your app version or git hash. This helps force browsers to download fresh copies of assets when the key changes. Warning: Not Goroutine safe. Set once in main().

Types

This section is empty.

Jump to

Keyboard shortcuts

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