Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripting variants #11929

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap
Expand Up @@ -2424,5 +2424,19 @@ exports[`getVariants 1`] = `
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": false,
"name": "noscript",
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": false,
"name": "scripting",
"selectors": [Function],
"values": [],
},
]
`;
20 changes: 20 additions & 0 deletions packages/tailwindcss/src/variants.test.ts
Expand Up @@ -1546,6 +1546,26 @@ test('forced-colors', () => {
`)
})

test('noscript', () => {
expect(run(['noscript:flex'])).toMatchInlineSnapshot(`
"@media (scripting: none) {
.noscript\\:flex {
display: flex;
}
}"
`)
})

test('scripting', () => {
expect(run(['scripting:flex'])).toMatchInlineSnapshot(`
"@media (scripting: enabled) {
.scripting\\:flex {
display: flex;
}
}"
`)
})

test('container queries', () => {
expect(
compileCss(
Expand Down
3 changes: 3 additions & 0 deletions packages/tailwindcss/src/variants.ts
Expand Up @@ -701,5 +701,8 @@ export function createVariants(theme: Theme): Variants {

staticVariant('forced-colors', ['@media (forced-colors: active)'], { compounds: false })

staticVariant('noscript', ['@media (scripting: none)'], { compounds: false })
staticVariant('scripting', ['@media (scripting: enabled)'], { compounds: false })

return variants
}