diff --git a/src/transformers/removeInlinedSelectors.js b/src/transformers/removeInlinedSelectors.js index f5d36e26..faeb5e83 100644 --- a/src/transformers/removeInlinedSelectors.js +++ b/src/transformers/removeInlinedSelectors.js @@ -28,36 +28,38 @@ const plugin = () => tree => { const {selector} = rule const prop = get(rule.nodes[0], 'prop') - // If we find the selector in the HTML... - tree.match(matchHelper(selector), n => { - const parsedAttrs = parseAttrs(n.attrs) - const classAttr = get(parsedAttrs, 'class', []) - const styleAttr = get(parsedAttrs, 'style', {}) + try { + // If we find the selector in the HTML... + tree.match(matchHelper(selector), n => { + const parsedAttrs = parseAttrs(n.attrs) + const classAttr = get(parsedAttrs, 'class', []) + const styleAttr = get(parsedAttrs, 'style', {}) - // If the class is in the style attribute (inlined), remove it - if (has(styleAttr, prop)) { - // Remove the class attribute - remove(classAttr, s => selector.includes(s)) - - // Remove the rule in the