- From: 88jonhan via GitHub <sysbot+gh@w3.org>
- Date: Thu, 11 Apr 2024 12:26:55 +0000
- To: public-css-archive@w3.org
88jonhan has just created a new issue for https://github.com/w3c/csswg-drafts: == Separate multi-line and single-line comments with different syntax for each == Today we comment our css with the syntax /* */ regardless if we want to add a single line comment or a multi line comment. Eg: ``` /* This is a single line comment */ /* This is a multi line comment */ ``` This is generally not an issue when we want to add a comment that for example explains the css, or seperates the code in to different sections for clarity and readability. Sometimes we want to comment out a small or large section of the css. We do this for testing purposes, debug, prevention of implementation and probably a multitude of other reasons. Using the same syntax for single-line and multi-line comments becomes an issue when we for example want to comment out a section of the css that includes a comment. Eg. ``` /* A comment */ .css-class { } /* Another comment */ .another-css-class { } ``` Let's say that I for some reason want to comment out both of these css selectors. If I try to wrap the css inside a comment, it will not work because the first comment end-tag will end every previous comment section, even if there is multiple comment start-tags. So to solve this we have to either remove the original comments or remove the original comment tags. The original comments that we have to remove are probably there for a good reason, and this becomes a risk when we remove the newly added comment and have to either add back the original comments or add back the comment tags around the commented text. My suggestion is therefore to add a second single-line comment syntax, similar to how other frameworks and languages have solved it. My suggestion is to use double-slash (//) as a sngle line comment, and keep /* */ as a multi-line comment. We can still use /* */ for single line comments, but this negates the issue with trying to comment out already commented css. ``` /* Commented out for some reason // A comment .css-class { } // Another comment .another-css-class { } */ ``` I do not know which section this belongs to but my guess is [css-syntax-3](https://github.com/w3c/csswg-drafts/tree/b4f1749651bb368e0bcd5633d85907c7db94db0f/css-syntax-3) Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10198 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 11 April 2024 12:26:56 UTC