Hacker News new | ask | show | jobs
by MLMcMillion 5190 days ago
Can someone explain the use of // instead of /* */ for CSS comments? According to what I've always known, // isn't even valid.
2 comments

They are using .scss, so // is valid there.

Prefixing each commented line is more efficient in text editing than wrapping things in blocks. Editor support for mappings to comment out sections of text are more consistent in supporting prefixing each line and removing that than wrapping and unwrapping a selection with the block syntax.

Also, that way you can comment out a larger section and subsequently uncomment a part of that section with a single action instead of uncommenting the entire thing, then re-commenting the part that you still want commented out.

Ah, gotcha. I read "CSS" and just, you know, assumed "CSS".
Although any compressor or minifier will strip out comments, '//' comments in SCSS will be ignored even if you choose not to compress.

It's a really insignificant detail in and of itself, and zefhous' comment provides a far more substantial rationale.