From 38d944977786b276334e76c270b17b54590bfbeb Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 20 Mar 2021 19:52:10 +0000 Subject: [PATCH] fupstatic: init embedding package --- web/fup/fupstatic/fupstatic.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 web/fup/fupstatic/fupstatic.go diff --git a/web/fup/fupstatic/fupstatic.go b/web/fup/fupstatic/fupstatic.go new file mode 100644 index 0000000000..0a96865308 --- /dev/null +++ b/web/fup/fupstatic/fupstatic.go @@ -0,0 +1,23 @@ +package fupstatic + +import ( + "embed" + "io/fs" +) + +//go:embed css js +var static embed.FS + +var Static fs.FS = newStaticFS(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 +}