W3C home > Mailing lists > Public > www-style@w3.org > February 2011

Re: CSS Variables

From: Peter Beverloo <peter@lvp-media.com>
Date: Sun, 6 Feb 2011 13:36:27 +0100
Message-ID: <AANLkTimaaNmDrAcxiSqrZ+JzOiUsPwXM6KT4W-53ndok@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Daniel Glazman <daniel.glazman@disruptive-innovations.com>, www-style list <www-style@w3.org>
On Sun, Feb 6, 2011 at 12:32, Daniel Glazman
<daniel.glazman@disruptive-innovations.com> wrote:
>
> Le 06/02/11 01:34, Tab Atkins Jr. a écrit :
>>
>> The syntax isn't complex.  What we're going with so far is this:
>>
>> @var $foo red;
>
> I don't understand that $ at all and I think it is useless. Just make
> the first parameter following @var an ident and that's enough. Using
> $var to ACCESS a variable is fine, modulo the impact on parsing. I admit
> I haven't thought at it yet. Thinking out loud, I think the var()
> notation is better because more conformant to CSS's common practice.
> It will also be easier to implement.
> I don't think the preprocessing-on-server-side argument is a good one.
> The purpose of a Variables spec is to obsolete such preprocessing
> anyway.

Omitting the dollar-sign prefix would certainly have my preference, as
long as it's for both declaring a variable as for using a variable.
While potentially minor, requiring authors to declare a variable
without the prefix, and use it with the prefix, would create an
inconsistency and add to the complexity of using variables.  Therefore
I'd be in favor of the following:

@var foo red;
bar {
    color: var(foo);
}

Furthermore, I'm curious about the naming requirements for variable
identifiers.  Which characters are allowed, and are the identifiers
case-sensitive?

One part of your blog post I am opposed to is the inclusion of CSS
Modules.  The concept closely approaches that of CSS Namespaces, and
when talking about "CSS Modules", the first thing that comes to mind
are the modules which are part of CSS Level 3.  Neither two
definitions of namespaces nor two definitions of modules can be
desirable.

Based on the fact that the namespacing concept is already available in
CSS, I'm more in favor of advocating prefixing of variable names to
authors from the first ED forward (e.g. @var csswg-example red).  This
would be consistent with other parts of their CSS and JavaScript code
as well, which many projects and libraries already do.

Regards,
Peter Beverloo
Received on Sunday, 6 February 2011 12:37:00 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:37 GMT