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

On Wed, Mar 12, 2014 at 9:40 PM, Chris Eppstein <chris@eppsteins.net> wrote:
> _property is a common CSS hack targeting IE6. So those in-the-wild stylesheets would suddenly start being interpreted as variables by modern browsers.
>
> Maybe not a big deal...

Probably not.  Custom properties don't *do* anything by themselves,
and polluting a page with a few extra variables isn't a huge deal.

> Aesthetically, I find underscores in CSS files displeasing.

I agree, but I don't have much space to work here. ^_^

> An issue we're bumping into in the sass community now is namespace collisions from 3rd-party libraries. It would be nice if CSS could avoid our mistake by forcing a namespace for custom properties.
>
> Is there any reason we can't use dot notation for this?
>
> div {
>   my.color: red;
>   bootstrap.color: blue;
>   color: my.color;
>   background-color: bootstrap.color;
> }

"." isn't part of <ident-token>, so that gets parsed as three tokens
in total, which is a bit awkward.  Why do you like "." better than
"_"?

> And yes, I think we should have right hand side symmetry with the declaration.

We've had this discussion before, and I think there are still several
good reasons to stick with a function for variable use.

~TJ

Received on Thursday, 13 March 2014 17:49:07 UTC