Including external css in Go html templates

I have a home.html spirit home.css inside a templates directory. I included the home.css file in the home.html file as:

<link href= "./home.css" rel = "stylesheet">

Now inside my main package file, I have the following code:

package main



 func home(w http.ResponseWriter, r* http.Request){

   temp , _ := template.ParseFiles("./templates/home.html")

   temp.Execute(w, nil)

 func main(){
  router := mux.NewRouter()

But I can not see the change in the website and when I checked the debugger console, I get the following errors:

The resource from “http://localhost:3000/home.css” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff).

Leave a Comment