Skip to content

Instantly share code, notes, and snippets.

@jonesnxt
Created July 26, 2022 19:05
Show Gist options
  • Save jonesnxt/7564dfb72be312276cd7b2ca126a23ad to your computer and use it in GitHub Desktop.
Save jonesnxt/7564dfb72be312276cd7b2ca126a23ad to your computer and use it in GitHub Desktop.
styleSheets.map((sheet) =>
Array.from(sheet.cssRules).map((rule) =>
rule.type === rule.FONT_FACE_RULE
? { /* include this rule */ }
: rule.type === rule.STYLE_RULE
? { /* include this rule if above-the-fold */ }
: rule.type === rule.MEDIA_RULE
? Array.from(rule.cssRules)
.map((mediaRule) =>
mediaRule.type === mediaRule.FONT_FACE_RULE
? { /* include this rule */ }
: mediaRule.type === mediaRule.STYLE_RULE
? { /* include this rule if above-the-fold */ }
: { /* don't include */ }
)
: { /* don't include */ }
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment