diff --git a/src/transformers/legacyLogicalProperties.ts b/src/transformers/legacyLogicalProperties.ts index 1a2e678..7d16c2d 100644 --- a/src/transformers/legacyLogicalProperties.ts +++ b/src/transformers/legacyLogicalProperties.ts @@ -16,7 +16,7 @@ function splitValues( .split(/\s+/); // Combine styles split in brackets, like `calc(1px + 2px)` - let temp = ''; + let temp: string[] = []; let brackets = 0; return [ splitStyle.reduce((list, item) => { @@ -25,11 +25,10 @@ function splitValues( const right = item.split(')').length - 1; brackets += left - right; } + if (brackets >= 0) temp.push(item); if (brackets === 0) { - list.push(`${temp} ${item}`); - temp = ''; - } else if (brackets > 0) { - temp += ` ${item}`; + list.push(temp.join(' ')); + temp = []; } return list; }, []),