Skip to content

Commit

Permalink
fix: media expression is not converted if it has no screen parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackardios committed Jan 31, 2023
1 parent a2b62fe commit 51bf52f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/TailwindConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,15 @@ export class TailwindConverter {
}
}

const mappedScreen = this.config.mapping.screens[screens.join(' and ')];
if (screens.length > 0) {
const mappedScreen = this.config.mapping.screens[screens.join(' and ')];

if (!mappedScreen) {
return '';
}
if (!mappedScreen) {
return '';
}

modifiers.push(mappedScreen);
modifiers.push(mappedScreen);
}

const classPrefix = modifiers.join(':');

Expand Down
1 change: 1 addition & 0 deletions test/TailwindConverter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('TailwindConverter', () => {
'aspect-video',
'content-center',
'content-end',
'portrait:text-[black]',
"after:content-['*']",
'after:select-text',
'after:align-text-top',
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/input.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
align-content: center; /* duplicate */
align-content: flex-end; /* duplicate with another value */

@media (orientation: portrait) {
color: black;
}

&::after {
content: '*';
user-select: text;
Expand Down

0 comments on commit 51bf52f

Please sign in to comment.