Goodbye SASS, welcome back native CSS (medium.com)
from pcouy@lemmy.pierre-couy.fr to programming@programming.dev on 08 Jan 2025 18:09
https://lemmy.pierre-couy.fr/post/909241

#programming

threaded - newest

frezik@midwest.social on 08 Jan 2025 18:21 next collapse

I like that css now has variables, but why that syntax?

[deleted] on 08 Jan 2025 18:26 next collapse

.

GammaGames@beehaw.org on 08 Jan 2025 18:30 collapse

I think to make sure they don’t clash with existing identifiers

frezik@midwest.social on 08 Jan 2025 18:45 collapse

I could understand declaring with –foo, but then referencing should be either var(foo) or just –foo, not the combination var(–foo). I don’t get why the grammar has to work that way.

joachim@drupal.community on 08 Jan 2025 18:15 next collapse

@pcouy The URL is broken.

pcouy@lemmy.pierre-couy.fr on 08 Jan 2025 18:23 collapse

It seems to be working for me, it’s weird. I’ve updated the post with the same URL anyway, and you can try …bus-hit.me/…/goodbye-sass-welcome-back-native-cs… if that still does not work

cupcakezealot@lemmy.blahaj.zone on 08 Jan 2025 18:35 next collapse

still can’t do mixins and extends though. :(

unmagical@lemmy.ml on 08 Jan 2025 18:37 next collapse

I, uh, hate that radius calculation. Why does the radius need to be reactive? What do you stand to gain over just setting to like 3 or 4px and moving on with your life?

x00z@lemmy.world on 08 Jan 2025 19:44 next collapse

Junior webdev points.

unmagical@lemmy.ml on 08 Jan 2025 20:01 collapse

Cool. Help me learn then by answering my questions.

tapdattl@lemmy.world on 08 Jan 2025 20:05 collapse

He did

[…] Why does the radius need to be reactive? What do you stand to gain over just setting to like 3 or 4px and moving on with your life?

Junior webdev points

AKA you gain nothing.

unmagical@lemmy.ml on 08 Jan 2025 20:19 collapse

Oof, I might have wooshed there. Totally read that comment as criticizing my inquiry as things a Jr would ask and not as the implementation being “look what I as a Jr can do!”

pcouy@lemmy.pierre-couy.fr on 09 Jan 2025 06:28 collapse

I’m not sure how this relates to the shared post. I’m just searched the article for “radius” and only found one example where a variable is defined then used later. Were you talking about this ? Or can you clarify what “radius calculation” you hate ?

lucas@startrek.website on 09 Jan 2025 10:25 collapse

They’re referring (I believe) to the screenshot right at the top of the article, which includes this absurd calculation:

border-radius: max (0px, min(8px, calc( (100vw - 4px - 100%) * 9999)) );

My guess (hope!) is that this is not ‘serious’ code, but padding for the sake of a screenshot to demonstrate that it’s possible to use each of these different features (not that you should!).

pcouy@lemmy.pierre-couy.fr on 09 Jan 2025 10:43 next collapse

border-radius: max(0px, min(8px, calc( (100vw - 4px - 100%) * 9999)) );

Oh I missed this. I think it’s only here to showcase doing math between different units, which is really nice in my opinion. I’m thinking about a few instances where I had to resort to dirty JS hacks just because CSS did not support this at the time

pinchy@lemmy.world on 09 Jan 2025 15:57 collapse

It‘s used in Facebooks css. Remembered it from a nice article from Ahmad Shadeed. And while this limbo sure has some usefulness, it‘s way too obscure to use for the fun of it.

To add to this: CSS really has come a long way. This border-radius example can be done with Container Queries by now, which has quite good support already.

TCB13@lemmy.world on 08 Jan 2025 19:02 next collapse

Yeah CSS is now decent. The only problem is that the nesting is not very well supported yet. It’s something like only browsers > 2023 and let’s be realistic people run old machines.

pinchy@lemmy.world on 08 Jan 2025 20:18 next collapse

Definitely not widely supported enough. Made the switch from sass back to css quite a while ago and let postcss polyfill less supported features like nesting.

TCB13@lemmy.world on 08 Jan 2025 23:18 collapse

Yeah, I was reading about PostCSS the other day, but still too lazy to change my environment. To be fair I only need the nesting polyfill and some kind of minifier, the rest I can live with native stuff.

pinchy@lemmy.world on 09 Jan 2025 06:24 collapse

Lightning CSS is also great. A minifier at its core but also includes transpiling for older browser

pcouy@lemmy.pierre-couy.fr on 09 Jan 2025 06:34 next collapse

We still see somewhat old browsers, especially from people using Safari on Apple devices (because IIRC it only updates when you update the whole OS). But it’s a lot better than it used to be thanks to most browser having auto-updates

TCB13@lemmy.world on 09 Jan 2025 12:41 collapse

Yeah, exactly.

Kissaki@programming.dev on 09 Jan 2025 19:45 next collapse

I’ve read interesting argumentation against nesting. I’m not confident in whether it’s more useful or not, in some situations or in general.

TCB13@lemmy.world on 09 Jan 2025 21:57 collapse

Trust me, you’ll code faster and your CSS will be way more readable.

CgH10N4Co2@lemmy.cafe on 02 Feb 03:15 collapse

Their machines might be old, but their browsers auto-update.

TCB13@lemmy.world on 02 Feb 10:24 collapse

Until you find they’re using and old version of macOS… or Windows 8. 😂

Paradox@lemdro.id on 08 Jan 2025 23:24 next collapse

I still reach for sass for a lot of things, but now you don’t have to, which is really nice

mindbleach@sh.itjust.works on 10 Jan 2025 03:08 next collapse

HTML tends to absorb all its best kludges. I put off learning JQuery for so long that the features I wanted became standard.

Cratermaker@discuss.tchncs.de on 10 Jan 2025 06:20 collapse

Good riddance, I say. Web dev is infested with layers upon layers of tools that attempt to abstract what is already fairly simple and straightforward to work with. We’re beyond the days of needing to build buttons out of small image fragments, and JS is (slowly) becoming more livable in its raw form. I welcome anything that keeps the toolchain as simple as possible.

shortrounddev@lemmy.world on 24 Jan 15:26 collapse

At my company I start all new projects without a framework. I try to write things in templated backend frameworks with no javascript on the frontend. If I need javascript, I try to use web components, styled with modular css in the shadow dom.

However, this sometimes requires an absurd amount of build tool configuration with webpack in order to get static asset and typescript loading working just perfectly. I end up kind of just writing my own framework instead