mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-09-09 04:39:11 -04:00

specifying a version breaks file generation with `-mod=vendor`, which is used by tooling like nixpkgs. this commit replaces the `go:generate` statement with ones found in other files (which builds successfully) for consistency. Signed-off-by: Cassie Cheung <me@soopy.moe>
37 lines
809 B
Go
37 lines
809 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 tool github.com/a-h/templ/cmd/templ 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))))
|
|
}
|