Re: [csswg-drafts] [css-conditional-4] Rename @when to @if (#6684)

@romainmenke wrote:

>Currently css @if conditionals with media(...) or supports(...) give parser errors.

@SebastianZ wrote:

>That's incorrect. E.g. @if media(screen) is valid in Sass as pointed out by @nex3's comment linked to above. See also https://github.com/w3c/csswg-drafts/issues/6684#issuecomment-1069762588.

I missed that. 
`@if <function token>(<ident token>)` indeed doesn't give errors in sass.
I do still keep wondering if this can not be made into a feature instead of a bug/issue.

```scss
  @if media(screen) and $light-theme {
    background-color: $light-background;
    color: $light-text;
  }
```

I now also realise that keeping both sass `@if` and css `@if` trades one real naming conflict for a much large amount of theoretical naming conflicts. Which is probably worse, but maybe it can work in practice?

List of function names from the conditionals posted above : https://gist.github.com/romainmenke/4cd042c331031538a441c2adf76a5c42

List of function names with `<function-token>(ident-token)` :

_functions with vendor prefixes or `_` prefixes where removed_

```
archive-list-default
archive-list-large
checkbox
col
color
config
contains
feature-exists
font
font-size
font_size
function-exists
get-font-family
global-variable-exists
global_variable_exists
gridle_get_state_var
gridle_is_driver
included
index
media-breakpoint-up
mixin-exists
mixin_exists
output
size-ratio
space-support
style-get
type-of
type_of
use-local-scope
using
v-is-included
var
variable-exists
variable_exists
variables-exists
viewport-exists
```

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 24 March 2022 06:56:41 UTC