-
I think I might be a little confused on how the css is meant to be handled in Templ (v0.2.648). I am using css class expressions as per the docs like so css HeaderBrand() {
font-weight: bold;
} and applying them like so For routing I am just using mux := http.NewServeMux()
mux.HandleFunc("GET /", handleLanding)
...
handler := templ.NewCSSMiddleware(mux, s.classes...)
server := &http.Server{
Addr: s.addr,
Handler: handler,
}
return server.ListenAndServe() Yet for some reason I am still seeing Any help is much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Please can you share the code of your http handler where you render the template? Just for more context? |
Beta Was this translation helpful? Give feedback.
I can see the issue now.
The way that the CSS middleware determines whether the CSS has already been rendered or not, is by setting the HTTP context.
However, you're passing
context.Background()
instead of passing ther.Context()
down through the templateRender
function.