Re: [csswg-drafts] [css-values][css-images] Allow trailing comma in gradient functions (and probably others) (#4968)

Sass doesn't have an easy way to track popularity of a feature, but it looks like we've supported trailing commas in many places since 3013, and basically everywhere since 2016. I'll dig deeper and see if I can find any exceptions, but I haven't found any yet. I can also try to survey use, if that's helpful.

Trailing commas on a single item are used internally to signify that the item should be treated as a `list` type, and we remove remove trailing commas when compiling to CSS. We do the same with trailing commas on a property:

```scss
$sass: item,; // -> a comma-separated list of one
.test { content:  $sass,; } // -> content: item;
```

I've most often seen it used in Sass list & map variables, though I often use it for gradients as well. My sense is that use in multi-line sass lists and maps is the norm rather than the exception. There was clamor in 2016 to allow it even more places than we did originally. But I also think people "trust" it more where the code is clearly a Sass-defined syntax (lists & maps), and are less likely to know we also support it in general CSS syntax (backgrounds, css functions, etc).

For a quick sample, this Sass:

```scss
body {
  background:
    linear-gradient(
      to right,
      red 20%,
      orange 20% 40%,
      yellow 40% 60%,
      green 60% 80%,
      blue 80%,
    ),
    linear-gradient(to top, black, transparent),
  ;
  width: clamp(0, 100%, 30em,),;
}
```

compiles to valid CSS without any trailing commas:

```css
body {
  background: linear-gradient(to right, red 20%, orange 20% 40%, yellow 40% 60%, green 60% 80%, blue 80%), linear-gradient(to top, black, transparent);
  width: clamp(0, 100%, 30em);
}
```

-- 
GitHub Notification of comment by mirisuzanne
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4968#issuecomment-617919631 using your GitHub account

Received on Wednesday, 22 April 2020 17:26:43 UTC