Is there a way to retrieve a list of all the CSS classes I have used in my code that do not have a corresponding "CSS ruleset" defined for them?
For example:
/*Definition (or Rule set) for .some-random-class
doesn't exist or is commented out like below
.some-random-class {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
*/
.known-class {
background-color: red;
width: 100px;
height: 100px;
}
<div class="some-random-class">
<span class="known-class"/>
</div>
I am hoping for a function such as getAllUndeclaredCSS()
to provide the output ['some-random-class']
.
Update 1: This is different from determining which CSS styles are actively being used, as I am looking for instances where the definitions are missing but the classes are being utilized.
Update 2: I currently have a basic solution to get me started. It may not cover all cases, but it works to some extent.