Re: CSS variable syntax

On Thu, Apr 3, 2014 at 10:57 AM, Chris Eppstein <chris@eppsteins.net> wrote:

> On Thu, Apr 3, 2014 at 7:41 AM, Mark Volkmann <r.mark.volkmann@gmail.com>wrote:
>
>> I don't see how referring to them as properties instead of variables
>> helps. There is still one syntax for setting them and one for getting them.
>> People are going to want to understand why it's good for it to be this way.
>> Many will be coming from LESS and Sass where it is not this way.
>>
>
> With the recent syntax change I think this is not hard to explain.
>
> You set a property like all properties are set:
>
> --foo: <value>
>
> In css, functions are how you represent a value that is not a literal.
> E.g. attr(). So it's not hard to explain why the var() accessor function
> exists.
>
> var(--foo)
>
> It's the same key in both cases. And seeing as how CSS has already used
> almost every special character[1] I can see on my keyboard right now, I
> think I'm ok with it not adding another sigil.
>
> Chris Eppstein
> Sass Core Team Member
>
> [1]: Only $, &, ?, <, `, and = are left. Note that $ was explicitly
> rejected here because CSS custom properties behave so differently from Sass
> variables.
>

I'm not familiar with what @ is being used for. Why couldn't variables
start with @?

Why would it be difficult to implement this so that --foo in a property
value means get the value of the foo property, making var(--foo)
unnecessary?

-- 
R. Mark Volkmann
Object Computing, Inc.

Received on Thursday, 3 April 2014 16:11:43 UTC