depot/web/fup/fupstatic/fupstatic.go

30 lines
480 B
Go
Raw Permalink 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"
2024-11-16 15:30:41 +00:00
"git.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
}