diff --git a/src/transformers/index.js b/src/transformers/index.js index 1f84e565..9422370b 100644 --- a/src/transformers/index.js +++ b/src/transformers/index.js @@ -27,10 +27,10 @@ exports.process = async (html, config) => { html = await attributeToStyle(html, config) html = await inline(html, config) html = await removeUnusedCSS(html, config) + html = await removeAttributes(html, config) html = await shorthandInlineCSS(html, config) html = await removeInlineSizes(html, config) html = await removeInlineBgColor(html, config) - html = await removeAttributes(html, config) html = await applyExtraAttributes(html, config) html = await applyBaseUrl(html, config) html = await addURLParams(html, config) diff --git a/src/transformers/removeInlineSizes.js b/src/transformers/removeInlineSizes.js index b02b86ca..866e5b6d 100644 --- a/src/transformers/removeInlineSizes.js +++ b/src/transformers/removeInlineSizes.js @@ -18,15 +18,14 @@ module.exports = async (html, config = {}, direct = false) => { const removeInlineSizes = (mappings = {}) => tree => { const process = node => { - const attrs = parseAttrs(node.attrs) - Object.entries(mappings).forEach(([attribute, tags]) => { tags = Object.values(tags).map(tag => tag.toLowerCase()) - if (!tags.includes(node.tag)) { return node } + const attrs = parseAttrs(node.attrs) + tags.forEach(() => { if (get(node, 'attrs.style')) { delete attrs.style[attribute]