Remix.run Logo
themafia 9 hours ago

It's a great way to make conditional styles without having to use JavaScript; however, having used JS for years to make theme color and icon sets that rely on CSS properties, I'm not sure I particularly like this method. I feel like you have to smear a lot of logic across your CSS whereas with JS you can reduce your theme to a data structure and just have a simple function to setup all the CSS variables based on that.

Am I just an old man?

bawolff 6 hours ago | parent | next [-]

The primary goal is to just have a more concise way to do @media queries. Its not intended as a replacement for most uses of JS

6031769 an hour ago | parent [-]

If we've learned anything from the history of CSS, JS and the semantic web it is that 99% of the time a feature will be used in ways that were not intended. There is no reason to suppose that this will be any different.

mmis1000 7 hours ago | parent | prev | next [-]

Javascript always suffer from FOUC problem though (Unless it's server side). Although the if() css function seems to just be syntax suger of standard @media query. So it doesn't really add anything to solve existing problems.

Edited: It seems it can also be toggled from css variable? So it might actually fix some existing problems.

mikestorrent 4 hours ago | parent [-]

How hard would it be to have a response header that tells the browser "don't display anything at all until we ask you to from JS when we're ready"?

Considering the kinds of crap that have been done with headers...

coke12 3 hours ago | parent | next [-]

Many sites do something like that in practice. The problem is the extra 500ms of parse+eval time for your JS bundle influences user behavior a lot on the margin, so it’s better to not force the user to wait.

Tajnymag 3 hours ago | parent | prev | next [-]

Would it be enough to have <body> hidden using an inline style in the initial html response and when everything is loaded, one would remove the style using javascript?

account42 2 hours ago | parent | prev | next [-]

How hard would it be to use JS for progressive enhancement instead making your website depend on it to display simple text and images.

mmis1000 3 hours ago | parent | prev [-]

Practically only cordova does these for now. But it's a native app so of course it can do whatever it want.

functionmouse 8 hours ago | parent | prev | next [-]

I like making static informational pages and don't know the first thing about JavaScript, so this could be handy for me.

kevin_thibedeau 8 hours ago | parent | prev | next [-]

Just use SCSS to smear the logic across CSS automatically.

Denote6737 2 hours ago | parent | prev [-]

God forbid we use html5