From 39422d16becfe06cbf3097825633b5952cd024d2 Mon Sep 17 00:00:00 2001 From: sandyx Date: Tue, 19 Nov 2024 12:14:07 -0600 Subject: [PATCH] embed css --- main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index fee01a9..c0e8ff1 100644 --- a/main.go +++ b/main.go @@ -8,8 +8,12 @@ import ( "net/http" "net/url" "os" + _ "embed" ) +//go:embed styles.css +var styleSheet string + //easily put attrs in a tag type htmlAttrs map[string]string func (attrs htmlAttrs) String() string { @@ -109,12 +113,8 @@ func main() { contents = wrapWithTagAttrs(contents, "div", gridContainerAttrs) contents = wrapWithTag(contents, "pre") - style, err := os.ReadFile("styles.css") - if err != nil { - log.Fatal(err) - } - contents = wrapWithTag(string(style), "style") + contents - //contents = wrapWithTag("", "head") + contents + + contents = wrapWithTag(string(styleSheet), "style") + contents contents = wrapWithTag(contents, "html") contents = "" + contents