Skip to content

Instantly share code, notes, and snippets.

@JO3-W3B-D3V
Created July 4, 2019 11:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JO3-W3B-D3V/e4a4e5b3bfb04c3007cf4bf6a14e63a6 to your computer and use it in GitHub Desktop.
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.
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