Repository navigation
Replies: 2 comments 3 replies
|
Hi there! Tailwind is optional, the project generator has a plain CSS path too. For scoped selectors today, you can use native @scope (.profile-card) {
.title {
color: rebeccapurple;
}
}Give the component's root element This gives you browser-level DOM scoping. It doesn't generate unique component classes or reproduce Svelte/Vue's compiler-based style isolation, and normal CSS inheritance still applies. For older browsers, a prefixed selector such as For the roadmap part, #401 is still an open proposal, with no implementation date announced in that thread. |
|
Yes I think component level CSS would be nice to have. I totally understand that Tailwind isn't for everyone; I used to feel the same way. Unfortunately it's a bit of a head scratcher how exactly this should look and be implemented. We're open to ideas! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi there — thanks for all the work on Topcoat. I've been looking at it from the outside and it looks genuinely promising: I'm currently weighing up ditching Django + SvelteKit in favour of something purely Rust, and Topcoat is one of the projects that makes that feel realistic.
So this is very much a newcomer's question, and I wanted to check I'm not missing an existing feature.
Global CSS — I can see this works today: declare a
.cssfile as an asset and link it from a layout (asset!("styles.css")), which is exactly what the defaulttopcoat newtemplate does when Tailwind is disabled. So plain CSS clearly isn't impossible.Component-scoped CSS — this is the part I can't find. Is there a supported way to attach styles to a component so that they're scoped to it, the way an SFC
<style>block does in Svelte or Vue? As far as I can tell, a<style>block written insideview!is HTML-escaped (so>and&needUnescaped), and once it renders it's global anyway. Coming from SvelteKit, scoped styles are the one thing I'd really miss.So, a few questions:
view!and#[component]to stay styling-agnostic and lean on external stylesheets?style!macro, generated scoped class names, an asset-backed CSS module, something else?To be upfront about where I'm coming from: I'm not personally a fan of utility-class-per-element as the primary styling model. I find it harder to keep a component's styles co-located and reusable, and it feels more like sidestepping the scoping question than solving it. But I'd much rather understand the actual design intent than assume it, which is what prompted this question. If Tailwind is deliberately the intended answer, that's completely fair — I'd just like to know so I can plan around it.
Thanks for your time!
All reactions