anubis/xess/xess.go
Xe Iaso 6b2ae30bae
web/js: show more errors when some probable error cases happen (#151)
Closes #150

This should hopefully make Anubis more self-describing when errors do
happen so users can self-service.
2025-03-28 15:47:18 -04:00

37 lines
815 B
Go

// Package xess vendors a copy of Xess and makes it available at /.xess/xess.css
//
// This is intended to be used as a vendored package in other projects.
package xess
import (
"embed"
"net/http"
"path/filepath"
"github.com/TecharoHQ/anubis"
"github.com/TecharoHQ/anubis/internal"
)
//go:generate go run github.com/a-h/templ/cmd/templ@latest generate
var (
//go:embed *.css static
Static embed.FS
URL = "/.within.website/x/xess/xess.css"
)
func init() {
Mount(http.DefaultServeMux)
if anubis.Version != "devel" {
URL = filepath.Join(filepath.Dir(URL), "xess.min.css")
}
URL = URL + "?cachebuster=" + anubis.Version
}
func Mount(mux *http.ServeMux) {
mux.Handle("/.within.website/x/xess/", internal.UnchangingCache(http.StripPrefix("/.within.website/x/xess/", http.FileServerFS(Static))))
}