News for hackers. Stuff that matters.
Re:Show HN: A completely different way to write responsive, ... by progx on Friday July 17, 2020 @03:43AM (#23868177)
For vanilla css-writer it could be a game changer, but who writes vanilla css in 2020? SASS make it so easy to write complex css simple.

css-media-vars would be a game changer for me, if it will be possible to use one var and not define many varnames and put them together to one var.

Like your Example:

  --xs-width: var(--media-xs) 100%;
  --sm-width: var(--media-sm) 49%;
  --md-width: var(--media-md) 32%;
  --lg-width: var(--media-gte-lg) 24%;
  width: var(--xs-width, var(--sm-width, var(--md-width, var(--lg-width))));
If it would work something like this, it would be really awesome:

  --width: var(--media-xs) 100%;
  --width: ifundefvar(--media-sm) 49%;
  --width: ifundefvar(--media-md) 32%;
  --width: ifundefvar(--media-gte-lg) 24%;
  width: var(--width);
Or

  --width: var(--media-xs) 100%
    else var(--media-sm) 49%
    else var(--media-md) 32%
    else var(--media-gte-lg) 24%
    else 5%
  width: var(--width);
Re:Show HN: A completely different way to write responsive, ... by Brajeshwar on Friday July 17, 2020 @05:29AM (#23868814)
Personally, I believe more and more people will be writing plain CSS as its power rises. These days, if I'm quick starting something and prototyping something before the team takes it over, I stay with just plain CSS. Of course, it is faster and easier for teach new developers with Sass.

Don't take me wrong - I love SASS. Well, I wrote one of the early Less to Sass translator for Bootstrap (I think around 2009) and wrote Sass syntax plugins for the likes of Coda editor.

However, if I want to build something today that needs to stand the test of time, I know I can write in HTML + CSS and it will be still work (likely) a century from now, without me having to re-install NPM Packages and compile my Sass to CSS. Of course, I might garnish it finally with PostCSS to take advantage of the modern tooling and augment the lacking of current CSS.

P.S. Recently, I was trying to update an old project and looks like Sass deprecated node sass in favor of something new. I'm not even able to keep up with which processor is the right one to use!

Re:Show HN: A completely different way to write responsive, ... by SiVal on Friday July 17, 2020 @06:09AM (#23869009)
I write vanilla CSS in 2020, but I suspect you're right in a "most people" sense. Still, I'm biased toward longer-lived approaches, meaning that whenever I can make it practical, I try to build with vanilla HTML, CSS, & JS with as few other technologies & libs as I practically can. Even my final HTML tends to be quite human-readable.

Again, this won't work for many projects, but the point of it is long-term maintainability. I assume that most of what is built into major, recent browsers will have the longevity of bottled wine, while technologies outside the browser will be more like fresh grapes. If I want the site itself to be more like the wine than the grapes, doing something with it years from now shouldn't require a tool that no one has used for years.

Re:Show HN: A completely different way to write responsive, ... by PetahNZ on Friday July 17, 2020 @08:13AM (#23869673)
To be fair sass variables have been around much longer than css variables.
Re:Show HN: A completely different way to write responsive, ... by SiVal on Friday July 17, 2020 @09:56AM (#23870484)
But it's not how long they've been around, it's whether they're built into standard browsers. Presumably, CSS variables can never be removed from standard browsers. They are permanently available in the web "toolchain". SASS can be replaced by something else. There will be workarounds, but it will probably be more of a problem.
Re:Show HN: A completely different way to write responsive, ... by PudgePacket on Friday July 17, 2020 @05:07AM (#23868673)
> but who writes vanilla css in 2020?

Even if your point is good, that's just not a productive way to start out.