Skip to content

[css-properties-values-api] named parameters in custom values #551

@brucelawson

Description

@brucelawson

my chums and I at Wix are working on a pre-processor that extends CSS
and we want to pass named parameters in a custom value, like this:

.root {
   -st-mixin:
       --Theme(
           color1 green,
           color2 red
       )

     display: flex;
  }

We're somewhat uncomfortable with assigning "color1" with the value
"green" with only a space between them. It feels like we should use some
other assigment marker, such as a colon similar to SASS:

 .root {
   -st-mixin:
       --Theme(
           color1:green,
           color2:red
       )

   display: flex;
  }

or, more weirdly, with an equals sign:

  .root {
   -st-mixin:
       --Theme(
           color1=green,
           color2=red
       )

   display: flex;
  }

We prefer the colon syntax, as it feels more CSS-y, and we're designing our APIs to be as close as possible to CSS, and to adhere to its syntax so that IDEs and code editors don't show our extensions as errors.

Has something like this been discussed with regards to the CSS Properties
and Values spec
(I think this is the spec that's most likely to be the one that would define such syntax), so we can use the same syntax and thereby future-proof our
project?

Hang loose and stay groovy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions