Strip empty rulesets that contain only CSS comments
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
Description
To reproduce:
Currently, when a ruleset contains nothing but a Less comment, that ruleset is considered empty and is stripped from the compile CSS output. The same is not true for CSS comments. Consider the following example:
Current behavior:
Expected behavior:
From a developer's perspective, I'd expect that the two rulesets would be treated equally, regardless of the comment format, and that neither would produce any CSS output.
When combined with nesting, this behaviour can lead to unnecessarily duplicated code, as was the case in the following issue:
https://phabricator.wikimedia.org/T372101
e.g.
Environment information:
lessversion: 4.2
p.s.
I think this is related to #2477 but I wasn't sure to what extent.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named in the issue. Start by reproducing the Less 4.2 example and trace how the compiler decides whether a ruleset is empty, comparing Less and CSS comments. Done means comment-only rulesets produce no CSS output consistently, including when nesting is involved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100