diff --git a/main.go b/main.go index bb20aad..fee01a9 100644 --- a/main.go +++ b/main.go @@ -35,7 +35,7 @@ func wrapWithTagHref(str string, tag string) string { } func serveStylesheet(w http.ResponseWriter, r *http.Request) { - sheet, err := os.Open("style.css") + sheet, err := os.Open("styles.css") if err != nil { http.Error(w, "File not found", http.StatusNotFound) return @@ -109,7 +109,12 @@ func main() { contents = wrapWithTagAttrs(contents, "div", gridContainerAttrs) contents = wrapWithTag(contents, "pre") - contents = wrapWithTag("", "head") + contents + style, err := os.ReadFile("styles.css") + if err != nil { + log.Fatal(err) + } + contents = wrapWithTag(string(style), "style") + contents + //contents = wrapWithTag("", "head") + contents contents = wrapWithTag(contents, "html") contents = "" + contents @@ -118,7 +123,7 @@ func main() { } http.Handle("/", http.HandlerFunc(handler)) - http.Handle("/style.css", http.HandlerFunc(serveStylesheet)) + //http.Handle("/styles.css", http.HandlerFunc(serveStylesheet)) log.Printf("Serving %s on HTTP port: %s\n", *directory, *port) log.Fatal(http.ListenAndServe(":"+*port, nil)) } diff --git a/style.css b/styles.css similarity index 89% rename from style.css rename to styles.css index 05fc86b..ae6ca72 100644 --- a/style.css +++ b/styles.css @@ -9,7 +9,7 @@ padding: 20px; background: green; border-radius: 20px; - border: 0px solid white; + border: 1px solid white; text-align: left; }