Replies: 1 comment 4 replies
-
I tried the following to work with pseudo classes where I wrap the component in a class and tried to use nested CSS but that isn't parseable. package components
css testClass() {
background-color: blue;
.foo:hover {
color: red;
}
}
templ Hello(name string) {
<div class={ testClass() }>
<div class="foo">Hello, { name }</div>
</div>
} |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all I'm moving my conversation from the templ slack channel to here to hopefully get some more eyes on this discussion.
I'm trying to understand how the CSSMiddleware provided by templ scales when you have a lot of CSS components in your templates. Perhaps I'm not understanding the example well enough but copying every CSS component to the middleware seems like there'd be a lot of lines, no? Not necessarily bad but I was wondering what people do with their CSS components at scale. I'm trying to avoid using tools like tailwind because you're not learning CSS really you're learning tailwind, but want the bandwidth saving of having 1 global stylesheet.
Secondly what are the best practices for accessing pseudo classes like
:hover
,:root
,etc
using templ's CSS components?Appreciate the help, I've been enjoying templ so far!
Beta Was this translation helpful? Give feedback.
All reactions