Original post

Hello,

I am getting an error when executing my index.gohtml template from that reads “Refused to apply style from (file path) because its MIME type (‘text/plain’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.” I’m able to render the skeleton of the site but not the styles.

Even if I pass a non-existent link into the href of the .gohtml file, I get the same error. I’ve explicitly made the link type “text/css”. I’m wondering if I need to Set() something in the Go code before executing the .gohtml file? I’ve tried the solution to another forum post which was to .Set(“Content-Type”, “text/css”) but that just spits out my actual HTML code from my file into the browser. Any suggestions?

This is all I’m running in my go function:

func index(w http.ResponseWriter, r *http.Request){
err := tpl.ExecuteTemplate(w, “index.gohtml”, nil)
if err != nil{
panic(err.Error())
}
}