Remix.run Logo
codethief an hour ago

Global styles are like global state in software: They're best avoided.

xigoi 34 minutes ago | parent | next [-]

Global state is bad because it’s mutable. Global styles are not mutable.

IceDane 22 minutes ago | parent [-]

No.. that's not the only reason.

Global state is bad because it makes it hard to reason about your system. The global state can affect any part of it, or, focusing on the inverse which is probably better applied to global styles, any part of your system can depend on the global state.

It's also weird to say "global styles are not mutable" - you're right, they're (generally) not mutable, at runtime. But they are mutable in the sense that your developers (you, or your colleagues, or someone in 3 years maintaining your code) can mutate them, and if large parts of your system are implicitly dependent on the CSS cascading properly and so on, then those changes can have unintended consequences.

Of course, that can also apply to tailwind, to some extent. A developer can change a class (custom or otherwise) or the configuration - but at least it is very clear what is being changed and what parts will be affected (just grep).

Sankozi an hour ago | parent | prev [-]

So no CSS files at all? Only inline styles?