depot/web/fup/fupstatic/fupstatic.go
Luke Granger-Brown 5846385513 fup: move hashfs into its own package.
We need to depend on its API for fuphttp, so it's better if it's a separate
package to avoid embedding things we don't need.

In general it's probably a good idea to separate the logic from the embedded
content...
2021-03-20 23:43:59 +00:00

29 lines
475 B
Go

// SPDX-FileCopyrightText: 2021 Luke Granger-Brown <depot@lukegb.com>
//
// SPDX-License-Identifier: Apache-2.0
package fupstatic
import (
"embed"
"io/fs"
"hg.lukegb.com/lukegb/depot/web/fup/hashfs"
)
//go:embed css js
var static embed.FS
var Static *hashfs.FS = hashfs.New(static)
//go:embed tmpl
var templates embed.FS
var Templates fs.FS = must(fs.Sub(templates, "tmpl"))
func must(fsys fs.FS, err error) fs.FS {
if err != nil {
panic(err)
}
return fsys
}