depot/web/fup/fupstatic/fupstatic.go

29 lines
480 B
Go

// SPDX-FileCopyrightText: 2021 Luke Granger-Brown <depot@lukegb.com>
//
// SPDX-License-Identifier: Apache-2.0
package fupstatic
import (
"embed"
"io/fs"
"git.lukegb.com/lukegb/depot/web/fup/hashfs"
)
//go:embed css js img
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
}