diff --git a/src/replaceJsxExpressionContainer.js b/src/replaceJsxExpressionContainer.js index 5dd6a01..76d39bb 100644 --- a/src/replaceJsxExpressionContainer.js +++ b/src/replaceJsxExpressionContainer.js @@ -33,7 +33,7 @@ export default ( return typeof attribute.name !== 'undefined' && attribute.name.name === destinationName; }); - if (destinationAttribute) { + if (destinationAttribute && destinationAttribute !== sourceAttribute) { path.node.openingElement.attributes.splice(path.node.openingElement.attributes.indexOf(destinationAttribute), 1); } @@ -56,7 +56,7 @@ export default ( args ); - if (destinationAttribute) { + if (destinationAttribute && destinationAttribute !== sourceAttribute) { if (isStringLiteral(destinationAttribute.value)) { path.node.openingElement.attributes.push(jSXAttribute( jSXIdentifier(destinationName), diff --git a/src/resolveStringLiteral.js b/src/resolveStringLiteral.js index f62e42a..f09c7f4 100644 --- a/src/resolveStringLiteral.js +++ b/src/resolveStringLiteral.js @@ -30,7 +30,7 @@ export default ( return typeof attribute.name !== 'undefined' && attribute.name.name === destinationName; }); - if (destinationAttribute) { + if (destinationAttribute && destinationAttribute !== sourceAttribute) { if (isStringLiteral(destinationAttribute.value)) { destinationAttribute.value.value += ' ' + resolvedStyleName; } else if (isJSXExpressionContainer(destinationAttribute.value)) {