Live data from Hacker News

CSS Variables landing in Chrome 49

developers.google.com

1–10 of 70 posts

Re: CSS Variables landing in Chrome 49

#2
custom props beginning with 2 dashes is slightly annoying given the BEM syntax has already grabbed that as Modifier...

  .foo {
    &--bar {
      --bar: 0;
    }
  }
It's a pretty contrived example, but akward to comprehend at first glance.

Re: CSS Variables landing in Chrome 49

#3
post #2

custom props beginning with 2 dashes is slightly annoying given the BEM syntax has already grabbed that as Modifier... .foo { &--bar { --bar: 0; } } It's a pretty contrived example, but akward to comprehend at first glance.

[deleted]

Re: CSS Variables landing in Chrome 49

#5
post #4

Ok, that's cool. How long until we're able to use this and not have to worry about browser incompatibilities?

It depends on what browsers you need to support. Based on this data http://caniuse.com/#feat=css-variables I think it will be quite some time before you see this in sites that need broad browser compatibility. Surely there will be (is?) a shim that will come along.

Re: CSS Variables landing in Chrome 49

#9
post #6
post #4

Ok, that's cool. How long until we're able to use this and not have to worry about browser incompatibilities?

~5 years depending on who you're targetting.

Pretty sad that in a world with living standards and silent updates, things that improve the state of the Web so vastly for developers still take so long to be widely available. (W3C doesn't even have a CR yet.) Less and Sass are nice, but the resulting CSS is full of repetition, thus hurting performance.

Am I right in assuming that IE won't receive any more feature updates? Many enterprises will stay on Win 7 for a while and enterprises traditionally embrace IE, so thank you, "new" Microsoft, for pushing things forward.

Re: CSS Variables landing in Chrome 49

#10
I've wondered for years why we're using pre-processing to get variables into CSS. Given that there hasn't been a commonly advocated workflow that didn't include some sort of CSS processor (like LESS or SASS) in about a decade, it seems like somebody working on the standards would have realized that CSS needed variables, at the very least. So, it's cool that it's coming, though it's taken a lot longer than I reckon it probably should have.

I would normally say, "But, at least there's been time to work out the syntax in non-core projects, so things are probably nice now." But, this syntax and behavior doesn't even resemble SASS or LESS. Is there some other tool out there that provides variables in CSS that this is modeled after? Why reinvent the wheel when so many people are already familiar with and have worked out the quirks in SASS or LESS?

Reading the explanation for why they went this way (in short, because these are nothing like SASS variables, in the sense that SASS is more like a macro): http://www.xanthir.com/blog/b4KT0

Is somewhat unconvincing. Why not implement what's already working for people in SASS/LESS (in the way it's already working), and then move on to whatever it is they've implemented here later once it is clear it's something people want/need and once it's been worked out in pre-processors? (I don't think I quite grasp the entirety of the difference, either...is it merely a matter of scope and composability?).

Actually, someone in the comments maybe sums it up:

"In fact, let me see if I've got this straight in my head:

CSS preprocessors added a feature called variables, but which would more accurately be described as macros.

Browser vendors and the working group worked sporadically on an in-browser implementation and standardisation of this macro feature, and they also called it CSS variables.

The WG's focus shifted to a feature more akin to custom properties, but which retained the name CSS variables.

So, right now we have CSS variables in preprocessors, which are macros, CSS variables in browsers, which are custom properties, and maybe at some point in the future, macros in the browser, and actual variables in the browser." (Source: http://www.xanthir.com/b4KT0#4KT0-13 )

Post reply on HN