Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Track use of @theme in features
This will ensure files that use *just* `@theme` produce no output
  • Loading branch information
thecrypticace committed Sep 22, 2025
commit 6e02e8a91793fadb5b25b5ef9243d88aface9f85
10 changes: 10 additions & 0 deletions packages/tailwindcss/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5965,4 +5965,14 @@ describe('feature detection', () => {
expect(compiler.features & Features.AtImport).toBeTruthy()
expect(compiler.features & Features.Utilities).toBeFalsy()
})

test('Compiling a file with only `@theme` should produce no output', async () => {
let compiler = await compile(css`
@theme {
--tracking-narrower: -0.02em;
}
`)

expect(compiler.build([])).toEqual('')
})
})
5 changes: 5 additions & 0 deletions packages/tailwindcss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export const enum Features {

// `@variant` was used
Variants = 1 << 5,

// `@theme` was used
AtTheme = 1 << 6,
}

async function parseCss(
Expand Down Expand Up @@ -540,6 +543,8 @@ async function parseCss(
if (node.name === '@theme') {
let [themeOptions, themePrefix] = parseThemeOptions(node.params)

features |= Features.AtTheme

if (context.reference) {
themeOptions |= ThemeOptions.REFERENCE
}
Expand Down