Skip to content

Commit

Permalink
change order of transformers, put function below the guard
Browse files Browse the repository at this point in the history
  • Loading branch information
alextes90 committed Dec 15, 2023
1 parent 54f73ed commit 66694a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/transformers/index.js
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions src/transformers/removeInlineSizes.js
Expand Up @@ -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]
Expand Down

0 comments on commit 66694a6

Please sign in to comment.