W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: [css-variables] For consideration

From: Roland Steiner <rolandsteiner@google.com>
Date: Fri, 17 Aug 2012 18:44:48 +0900
Message-ID: <CACFPSphbb_n-NQh1L2i589j9eAGk0pvTSGWdFTeB8nsz1wSN6A@mail.gmail.com>
To: François REMY <fremycompany_pub@yahoo.fr>
Cc: Brian Kardell <bkardell@gmail.com>, www-style@w3.org
Just to bring this up for reference: in a way, things have come full circle
- when I originally proposed the "new-style" CSS variables I called them
"pseudo-properties", using a '::' prefix to mirror pseudo-elements (but the
prefix, whether '$', '::' or 'my-', is really a matter of preference).
Rather than having a function $() de-referening just variables, I suggested
an 'apply()' function that can be used with any property, whether custom or
not. I think this could have some useful applications outside
variables/custom properties. but perhaps is hard to implement, and raises
question with regard to shorthand properties.

That is, using your syntax, you could write:

    background-color: apply(parent.color);
    color: apply(parent.background-color);

to invert colors, not using any custom-property. Variables/custom
properties are just another source of data. For example, with SASS-like

    color: apply(my-color);
    background-color: darken(apply(my-color), 50%);
    border-color: darken(apply(my-color), 70%);


- Roland

On Tue, Aug 14, 2012 at 5:01 AM, François REMY <fremycompany_pub@yahoo.fr>wrote:

> Indeed Brian, thank you for pointing this out at the right time. To
> summarize this latest idea being under consideration, it's an attempt to
> make our own draft more compatible with the existing one, and to use even
> more of the developer's known design patterns.
> Proposed syntaxes include
>    $(my-var)/$(parent.my-var)
> and
>    ${my-var}/${parent.my-var}
> It's possible to include the $var syntax in this proposal (as a shortcut
> to ${my-var}), though I'm still not an huge fan of it.
> -----Message d'origine----- From: Brian Kardell
> Sent: Monday, August 13, 2012 7:52 PM
> To: www-style@w3.org
> Subject: [css-variables] For consideration
> I know that CSS Variables is to be discussed in the F2F and I wanted
> to make one last effort to make sure that anyone involved in those
> conversations was aware of the syntax-related counter proposal that
> François and I put together (CSS Custom Properties), what the
> differences are and why we put it together in the first place....
> Why...
> Essentially, every time new people reviewed the existing draft there
> was obvious confusion about what the syntax meant and how it worked
> (also what might be valid) because of the perceived relationship with
> the syntax in existing pre-processors. We saw this on the list, in
> offline conversations and later in the comments when Tab's post wound
> up on Hacker News.  A few of us began arguing the case that the
> problem was that it began based on some of those ideas, but evolved
> into something entirely different which fit CSS perfectly and that the
> syntax/verbiage/etc didn't evolve with it.  Some folks on the list
> encouraged us to fork the draft and submit a counter proposal.
> We did this and posted it at:
> http://fremycompany.com/TR/**2012/ED-css-custom/<http://fremycompany.com/TR/2012/ED-css-custom/>
> We also wrote two articles about it...
> http://briankardell.wordpress.**com/2012/06/28/properties-the-**
> new-variables/<http://briankardell.wordpress.com/2012/06/28/properties-the-new-variables/>
> http://fremycompany.com/BG/**2012/Explaining-CSS-Custom-**Properties/<http://fremycompany.com/BG/2012/Explaining-CSS-Custom-Properties/>
> The former also spent time on the front page of HN and included a poll
> -- while I realize it is not scientific and the number of respondents
> is small and potentially not representative (though there should be no
> 'bias' as I personally only sent it to people from the list who
> appeared to disagree), the results were:
> The existing Variables Draft.  18.52%
> The revised Custom Properties Draft.  74.07%
> Both are equal.  7.41%
> Either way, I think it's a win as Tab was able to (I think) at least
> pull in some of our examples/use-cases and things but I am definitely
> interested to see the minutes :)
> One final note - François and I also discussed last week editing the
> draft to do away with $parent() and just always use $() and allow it
> to use a dot notation in the arguments to specify parent (or whatever
> others wind up being necessary) - though we haven't updated it.
> -Brian
Received on Friday, 17 August 2012 09:46:23 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:02 UTC