summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/templates.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/templates/templates.go b/templates/templates.go
new file mode 100644
index 0000000..2328b6e
--- /dev/null
+++ b/templates/templates.go
@@ -0,0 +1,17 @@
+package templates
+
+import (
+ "embed"
+)
+
+//go:embed *.html
+var templates embed.FS
+
+// MustGetTemplate returns a template string with the given name.
+func MustGetTemplate(name string) string {
+ b, err := templates.ReadFile(name)
+ if err != nil {
+ panic(err)
+ }
+ return string(b)
+}