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