Created
May 18, 2020 14:09
-
-
Save maciejmyslinski/2dcb06a8dcfe4859a9fd36d9c15966d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.from(document.styleSheets).reduce((acc, cssStyleSheet) => { | |
const classNamesCount = Array.from(cssStyleSheet.cssRules).reduce( | |
(count, cssRule) => { | |
if (cssRule.selectorText && cssRule.selectorText.startsWith('.')) { | |
return count + 1; | |
} | |
return count; | |
}, | |
0 | |
); | |
return acc + classNamesCount; | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment