Created
April 12, 2022 11:12
-
-
Save langpavel/cc86b9fcd9e382da72def5584615ae48 to your computer and use it in GitHub Desktop.
filter all CSS rules
This file contains 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
function* cssRulesIterator() { | |
for(const stylesheet of window.document.styleSheets) { | |
for (const rule of stylesheet.cssRules) { | |
yield rule.cssText; | |
} | |
} | |
} | |
[...cssRulesIterator()].filter(ruleText => true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment