Last active
December 21, 2015 02:18
-
-
Save icodeforlove/6233788 to your computer and use it in GitHub Desktop.
logs out all stylesheets in chrome
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
| Array.prototype.slice.call(document.styleSheets).forEach(function (stylesheet, index, array) { | |
| if (!stylesheet.rules) return; | |
| console.groupCollapsed("Stylesheet #%s", index); | |
| Array.prototype.slice.call(stylesheet.rules).forEach(function (rule, index, array) { | |
| var properties = rule.cssText.match(/\{\s+?(.+)\s+?\}/); | |
| if (rule.type === 1) { | |
| console.log('%s%c %s', rule.selectorText, 'font-weight: normal; color: #999', properties ? properties[1] : ''); | |
| } else if (rule.type === 7) { | |
| console.log('@keyframes %s%c %s', rule.name, 'font-weight: normal; color: #999', rule.cssText.replace(/[^\{]*\{([\s\S]+)\}$/, '{$1}')); | |
| } | |
| }); | |
| console.groupEnd(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment