IssueRaiser

[css-conditional-4] Rename @when to @if

The reasoning for using `@when` over `@if` is [that `@if` clashes with Sass](https://github.com/w3c/csswg-drafts/issues/112#issuecomment-221669910), a widely used CSS preprocessor. To my knowledge, no other reasoning exists for this decision. However, there is a lot of pushback against this decision (and general philosophy) in #112. I have gathered quotes about this below. Some arguments against `@if` have been posted by Sass maintainers in https://github.com/w3ctag/design-principles/issues/335 which has received a lot of attention from the Sass community through [this tweet](https://twitter.com/SassCSS/status/1438966633226125314). My take: 1. Third party tools can change far more easily than web standards, which are supposed to last for decades. We don't want to be stuck with a weird `@when` keyword decades after Sass is not used any more, making for yet another funny story about "why CSS is weird". The whole point of preprocessors should be to prototype features for CSS' future. Designing CSS around Sass is going the wrong way up the proper chain of dependency. It's like Babel forcing TC39 to not change a proposal because too many people transpile it a certain way. 2. There are far more CSS users than users of any particular preprocessor, so their needs should be weighed _significantly_ more heavily. Not infinitely, but very significantly. 3. There is precedent for using `if` for conditionals in almost every language that includes conditional statements (and not just

Posted by LeaVerou on Sep 24, 2021, 3:26 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

github (Software)

[css-conditional-4] Rename @when to @if

LeaVerouSep 24, 2021, 3:26 PM

The reasoning for using `@when` over `@if` is [that `@if` clashes with Sass](https://github.com/w3c/csswg-drafts/issues/112#issuecomment-221669910), a widely used CSS preprocessor. To my knowledge, no other reasoning exists for this decision. However, there is a lot of pushback against this decision (and general philosophy) in #112. I have gathered quotes about this below. Some arguments against `@if` have been posted by Sass maintainers in https://github.com/w3ctag/design-principles/issues/335 which has received a lot of attention from the Sass community through [this tweet](https://twitter.com/SassCSS/status/1438966633226125314). My take: 1. Third party tools can change far more easily than web standards, which are supposed to last for decades. We don't want to be stuck with a weird `@when` keyword decades after Sass is not used any more, making for yet another funny story about "why CSS is weird". The whole point of preprocessors should be to prototype features for CSS' future. Designing CSS around Sass is going the wrong way up the proper chain of dependency. It's like Babel forcing TC39 to not change a proposal because too many people transpile it a certain way. 2. There are far more CSS users than users of any particular preprocessor, so their needs should be weighed _significantly_ more heavily. Not infinitely, but very significantly. 3. There is precedent for using `if` for conditionals in almost every language that includes conditional statements (and not just

Comments (0)

No comments yet. Start the discussion.

Comment on this issue