Re: [css-variables] ...let's change the syntax

On 16/03/2014 3:28 am, Tab Atkins Jr. wrote:
> No, we don't currently have that in any context, nor are there any
> current plans for such.  It would be *extremely* weird, since we don't
> use -foo in the core language at all, and so any case where a "-" can
> be put next to an ident-like token *already* requires a space between
> them, to avoid the "-" being interpreted as part of the ident.
> 
> I'm potentially open to tweaking Syntax here (the fact that it's in CR
> is just a Process sop; we can continue to change as
> prudent/necessary), but as Simon says, this is a larger change than
> just switching the naming pattern from one valid ident to another.
> I'll leave it to heycam to decide whether this is something that's
> possible to do within their shipping deadline or not.

I don't forsee "--" as needing any changes to our CSS parser, so it
shouldn't be any harder to switch to than "_".

Despite Brian's retraction of the suggestion, I think using "--" is
preferable to "_", on visual aesthetic grounds.  I also think it should
be required as a prefix, not just a substring anywhere.  That has the
advantage of being easier to check in the parser, as well as enforcing
some uniformity.

  p {
    --company-color-1: green;
    background-color: var(company-color-1);
  }

looks fine to me.  Underscores look very un-CSS-like.

I don't have too much of an opinion on whether we should change custom
property names from a "var-" prefix, but it does make sense to consider
it, to align with the naming of other (future) custom things in CSS.

Received on Saturday, 15 March 2014 20:54:50 UTC