Closes #125 Closes #40 Among other things, this moves all of the asset generation to run within the context of an npm script. Developer documentation stubs have been added so that people can get started more easily. The top-level Dockerfile (which is no longer used in production) has been removed as its presence has been causing confusion. This changeset will break it anyways. These changes will make for less "repo churn" as the static assets are built and rebuilt, at the cost of making the build step more complicated for downstream packagers. If this becomes a burden, we can explore making a "release tarball" that contains pre-massaged outputs.
37 lines
843 B
Go
37 lines
843 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
|
|
//go:generate npm run build
|
|
|
|
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))))
|
|
}
|