Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/corePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ export let variantPlugins = {
addVariant(screen, `@media ${query}`)
}
},

orientationVariants: ({ addVariant }) => {
addVariant('portrait', '@media (orientation: portrait)')
addVariant('landscape', '@media (orientation: landscape)')
},
}

export let corePlugins = {
Expand Down
1 change: 1 addition & 0 deletions src/lib/setupContextUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ function resolvePlugins(context, root) {
variantPlugins['darkVariants'],
variantPlugins['printVariant'],
variantPlugins['screenVariants'],
variantPlugins['orientationVariants'],
]

return [...corePluginList, ...beforeVariants, ...userPlugins, ...afterVariants, ...layerPlugins]
Expand Down
5 changes: 0 additions & 5 deletions tests/kitchen-sink.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,6 @@ div {
}
}
}
@media (orientation: portrait) {
.portrait\:text-center {
text-align: center;
}
}
@media (min-width: 1280px) and (max-width: 1535px) {
.range\:text-right {
text-align: right;
Expand Down
2 changes: 1 addition & 1 deletion tests/kitchen-sink.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" href="./tailwind.css" />
</head>
<body>
<div class="portrait:text-center range:text-right multi:text-left"></div>
<div class="range:text-right multi:text-left"></div>
<div
class="container hover:container sm:container md:container text-center sm:text-center md:text-center"
></div>
Expand Down
1 change: 0 additions & 1 deletion tests/kitchen-sink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ test('it works', () => {
theme: {
extend: {
screens: {
portrait: { raw: '(orientation: portrait)' },
range: { min: '1280px', max: '1535px' },
multi: [{ min: '640px', max: '767px' }, { max: '868px' }],
},
Expand Down
12 changes: 12 additions & 0 deletions tests/variants.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -899,3 +899,15 @@
}
}
}
@media (orientation: portrait) {
.portrait\:bg-yellow-300 {
--tw-bg-opacity: 1;
background-color: rgb(253 224 71 / var(--tw-bg-opacity));
}
}
@media (orientation: landscape) {
.landscape\:bg-yellow-300 {
--tw-bg-opacity: 1;
background-color: rgb(253 224 71 / var(--tw-bg-opacity));
}
}
4 changes: 4 additions & 0 deletions tests/variants.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@
<div class="lg:animate-spin"></div>
<div class="hover:animate-spin"></div>

<!-- Orientation variants -->
<div class="portrait:bg-yellow-300"></div>
<div class="landscape:bg-yellow-300"></div>

<!-- Stacked variants -->
<div class="open:hover:bg-red-200"></div>
<div class="file:hover:bg-blue-600"></div>
Expand Down