Created
February 12, 2020 20:54
-
-
Save tomhodgins/45d2ba2ea1c93f3797871e67b21b9639 to your computer and use it in GitHub Desktop.
Run these from your browser's JS console to get a report of everything JS can read from CSSOM
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
import(`https://unpkg.com/cssomtools`).then(({process, property}) => { | |
const found = new Set | |
process( | |
[ | |
property('color', true), | |
property('background-color', true) | |
], | |
rule => { | |
if (rule.style.color) { | |
found.add(rule.style.color) | |
} | |
if (rule.style.backgroundColor) { | |
found.add(rule.style.backgroundColor) | |
} | |
} | |
) | |
console.group('Colors used on site') | |
console.log(found) | |
console.groupEnd() | |
}) |
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
import(`https://unpkg.com/cssomtools`).then(({process, property}) => { | |
const found = new Set() | |
process( | |
[ | |
property('font', true), | |
property('font-family', true) | |
], | |
rule => { | |
if (rule.style.fontFamily) { | |
found.add(rule.style.fontFamily) | |
} | |
if (rule.style.font) { | |
found.add(rule.style.fontFamily) | |
} | |
} | |
) | |
console.group('Fonts used on site') | |
console.log(found) | |
console.groupEnd() | |
}) |
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
import('https://unpkg.com/cssomtools').then(({process, query}) => { | |
const found = new Set | |
process( | |
query(), | |
rule => { | |
if ( | |
rule.media | |
&& rule.media.mediaText | |
) { | |
found.add(rule.media.mediaText) | |
} | |
} | |
) | |
console.group('Media query breakpoints used on site') | |
console.log(found) | |
console.groupEnd() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment