logoalt Hacker News

themafiatoday at 1:37 AM3 repliesview on HN

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?


Replies

mmis1000today at 3:45 AM

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.

functionmousetoday at 3:04 AM

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

kevin_thibedeautoday at 2:33 AM

Just use SCSS to smear the logic across CSS automatically.