depot/web/fup/fupstatic/fupstatic.go

30 lines
479 B
Go
Raw Normal View History

2021-03-20 20:40:40 +00:00
// SPDX-FileCopyrightText: 2021 Luke Granger-Brown <depot@lukegb.com>
//
// SPDX-License-Identifier: Apache-2.0
2021-03-20 19:52:10 +00:00
package fupstatic
import (
"embed"
"io/fs"
"hg.lukegb.com/lukegb/depot/web/fup/hashfs"
2021-03-20 19:52:10 +00:00
)
2021-03-27 20:54:40 +00:00
//go:embed css js img
2021-03-20 19:52:10 +00:00
var static embed.FS
var Static *hashfs.FS = hashfs.New(static)
2021-03-20 19:52:10 +00:00
//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
}