Skip to content

Commit 60381fb

Browse files
add scripting variants
Co-authored-by: Luke Warlow <luke@warlow.dev>
1 parent cc8c069 commit 60381fb

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap

+14
Original file line numberDiff line numberDiff line change
@@ -2424,5 +2424,19 @@ exports[`getVariants 1`] = `
24242424
"selectors": [Function],
24252425
"values": [],
24262426
},
2427+
{
2428+
"hasDash": true,
2429+
"isArbitrary": false,
2430+
"name": "noscript",
2431+
"selectors": [Function],
2432+
"values": [],
2433+
},
2434+
{
2435+
"hasDash": true,
2436+
"isArbitrary": false,
2437+
"name": "scripting",
2438+
"selectors": [Function],
2439+
"values": [],
2440+
},
24272441
]
24282442
`;

packages/tailwindcss/src/variants.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,26 @@ test('forced-colors', () => {
15461546
`)
15471547
})
15481548

1549+
test('noscript', () => {
1550+
expect(run(['noscript:flex'])).toMatchInlineSnapshot(`
1551+
"@media (scripting: none) {
1552+
.noscript\\:flex {
1553+
display: flex;
1554+
}
1555+
}"
1556+
`)
1557+
})
1558+
1559+
test('scripting', () => {
1560+
expect(run(['scripting:flex'])).toMatchInlineSnapshot(`
1561+
"@media (scripting: enabled) {
1562+
.scripting\\:flex {
1563+
display: flex;
1564+
}
1565+
}"
1566+
`)
1567+
})
1568+
15491569
test('container queries', () => {
15501570
expect(
15511571
compileCss(

packages/tailwindcss/src/variants.ts

+3
Original file line numberDiff line numberDiff line change
@@ -701,5 +701,8 @@ export function createVariants(theme: Theme): Variants {
701701

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

704+
staticVariant('noscript', ['@media (scripting: none)'], { compounds: false })
705+
staticVariant('scripting', ['@media (scripting: enabled)'], { compounds: false })
706+
704707
return variants
705708
}

0 commit comments

Comments
 (0)