Created
July 4, 2019 11:05
-
-
Save JO3-W3B-D3V/e4a4e5b3bfb04c3007cf4bf6a14e63a6 to your computer and use it in GitHub Desktop.
Fun little snippet to get a web page(s) CSS in JavaScript as text.
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
var css = Array.from(document.styleSheets).reduce((l, s) => { | |
l.push([...s.cssRules].map(c => c.cssText)); | |
return l; | |
}, []).map(arr => arr.join()).join(); | |
console.log(css); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment