Skip to content

Commit

Permalink
fix(postcss-merge-rules): do not merge conflicting flex properties
Browse files Browse the repository at this point in the history
`place` conflicts with `justify` and `align`, even if they don't start
with the same property.
  • Loading branch information
ludofischer committed Feb 15, 2023
1 parent 2e89321 commit b69b8e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/postcss-merge-rules/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ function isConflictingProp(propA, propB) {
if (!a.base && !b.base) {
return true;
}
// Different base;
if (a.base !== b.base) {

// Different base and none is `place`;
if (a.base !== b.base && a.base !== 'place' && b.base !== 'place') {
return false;
}

Expand Down
8 changes: 8 additions & 0 deletions packages/postcss-merge-rules/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ test(
)
);

test(
'should not incorrectly extract flex properties',
processCSS(
'.a { place-content: center; justify-content: start; } .b { justify-content: start; place-content: center; }',
'.a { place-content: center; } .a,.b { justify-content: start; } .b { place-content: center; }'
)
);

test(
'should not incorrectly extract display properties',
passthroughCSS(
Expand Down

0 comments on commit b69b8e9

Please sign in to comment.