web

package
v0.264.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package web holds the files muster serves under /static/, plus the two root-scoped PWA documents (/sw.js and /manifest.webmanifest).

🔴 EVERY FILE IN static/ IS A BUILD INPUT, NOT AN ARTIFACT, AND THAT IS WHY app.css IS COMMITTED HERE AND IGNORED UPSTREAM. The `//go:embed` below makes `go build ./...` fail on a fresh clone if any of these files is absent — so a stylesheet that only exists after `npm run build:css` would mean the project does not build until a contributor discovers a step nothing told them about. The repository's .gitignore says the same thing in its first line: nothing `go build` needs may be ignored. `make css-check` is what keeps the committed copy from going stale.

⚠ NO `all:` PREFIX, DELIBERATELY. `//go:embed static` skips entries whose names begin with `.` or `_`. There are none, and adding one would be a silent omission — a vendored asset that stops being served with no build error. If a dotfile ever has to ship, change the directive AND add it to the derived asset test in internal/api, which is what would otherwise not notice.

Index

Constants

This section is empty.

Variables

View Source
var Files fs.FS = overlay{}

Files is what /static/ serves: the embedded tree (Static) with the generated files laid over it. Its root holds the static/ directory, as Static's does.

View Source
var Static embed.FS

Static holds everything served under /static/ (app.css, vendor/*.js, icons/*.png) as well as sw.js and manifest.webmanifest, which are served from the root so the service worker's scope is "/".

Functions

func Asset

func Asset(path string) string

Asset is the URL a page links a /static/ file at: the path with ?v=<content hash> appended, e.g. "/static/app.css?v=3f9c1a0b2d4e".

🔴 A CONTENT HASH, NOT THE BUILD VERSION. muster 0.43.0 shipped a stylesheet change (the "N new" pill's .top-20) behind an unversioned /static/app.css, and Cloudflare and browsers kept serving the old copy (the edge answered max-age=14400 with a cf HIT): the pill drew at the bottom of the page. The hash changes exactly when the file's bytes do, so a release that leaves a file alone leaves every cache of it warm, and one that changes it is a new URL no cache has seen. The server marks a URL carrying the CURRENT hash immutable (see internal/api staticHandler).

A path that is not in the embedded tree is returned unchanged — the static-assets test in internal/api fails on it first.

func AssetHash

func AssetHash(path string) string

AssetHash is the hash Asset appends for path ("" if it does not ship).

func Generated

func Generated() []string

Generated lists every generated file's URL path, sorted.

func Register

func Register(urlPath string, b []byte) string

Register adds a generated file at urlPath ("/static/js/<name>.js") and returns urlPath, so a package-level var can both register and name it.

It panics — at init, so a build that does it never starts — on a path outside /static/js/, on a path registered twice, and on a path the embed already carries: each would serve one of two different files under one URL.

Types

This section is empty.

Jump to

Keyboard shortcuts

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