Skip to content

Instantly share code, notes, and snippets.

@mikkoh
Created January 5, 2017 04:25
Show Gist options
  • Save mikkoh/5789d13c8f4a960436585d033922bdd5 to your computer and use it in GitHub Desktop.
Save mikkoh/5789d13c8f4a960436585d033922bdd5 to your computer and use it in GitHub Desktop.
export default (paths) => {
const rules = [];
Array.prototype.forEach.call(document.styleSheets, (sheet) => {
Array.prototype.forEach.call(sheet.cssRules, (rule) => {
paths.forEach((path) => {
if (rule.selectorText && rule.selectorText.endsWith(`${path[0]}_${path[1]}`)) {
rules.push(rule);
}
});
});
});
return rules;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment