New feature: empty rulesets analysis
When I was scrolling to some of my competitors’ websites, I noticed that analyze-css by Maciej Brencz was counting the amount of empty rules in your CSS. It seemed to me that this was easy to add to Wallace, so I did it in a short amount of time. Here is the explanation that will eventually end up in the docs in some form:
A rule (or ruleset) is considered empty when it contains no declarations. Whitespace is ignored when determining whether a rule is empty or not.
Examples
/* This is an empty rule */
.header {
}
/* This is also an empty rule */
.header {
}
/* This is not an empty rule */
.header {
margin: 10px;
}
Please note that at-rules are not part of this analysis, so an empty media query rule is not counted here. That might be a future improvement.
Finally, a link to the commit that contains this change.
Popular posts
Making Analyze CSS render 6 times faster
A deep-dive in how the Analyze CSS page renders 6 times faster by applying 2 basic principles.
CSS complexity: it's complicated
There's lots of places in CSS to have complexity, but we tend to focus on selectors most of the time. Let's have a look at other places too.