embed css

main
sandyx 1 year ago
parent 429f57494d
commit 39422d16be

@ -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("<link rel=\"stylesheet\" href=\"styles.css\">", "head") + contents
contents = wrapWithTag(string(styleSheet), "style") + contents
contents = wrapWithTag(contents, "html")
contents = "<!DOCTYPE html>" + contents

Loading…
Cancel
Save