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

On Tue, Mar 18, 2014 at 9:21 AM, François REMY
<francois.remy.dev@outlook.com> wrote:
>> As far as I understand, the main reason of
>> why Tab's original idea of using `$` has
>> eventually been dropped was some
>> uncertainty about its possible extensibility
>> for being used in property _names_ besides
>> property _values_.
>
> The reason it got dropped is that some people (including Tab) do believe we
> should reserve $ for mixins and other preprocessor-like operations which may
> potentially be added to the language at some point

More specifically, I think we should probably reserve $ for exactly
what SASS/etc do with it - as a macro replacement.  That would not
only match author expectations fairly closely, but would also avoid
stepping on SASS's toes and forcing them to change their own var
syntax.

 (e.g. futuristic things
> like:
>
>    @define apply-2d-transform(initial-scale, initial-rotation, ...) {
>        ...
>        my-transform-scaling: $initial-scale;
>        my-transform-rotation: $initial-rotation;
>        ...
>        transform:
>            scale(get(my-transform-scaling))
>            rotate(get(my-transform-rotation))
>            translate(get(my-transform-translation));
>        will-change[]:
>            transform;
>    }
>
>    .some-element {
>        $apply-2d-transform(...);
>        transition[]: transform 0.5s ease-in-out;
>    }
>
>    .some-element:hover {
>        my-transform-scale: 1.1;
>    }
>
> but this syntax was just made for this example, final milage may look
> completely different and/or offer different features)

Yes, "stylesheet vars" that apply lexically over a section of the
stylesheet, rather than applying to elements in the DOM, are exactly
what I'm hoping to use $ for.

~TJ

Received on Tuesday, 18 March 2014 17:38:40 UTC