File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525- Use ` default ` export condition for ` @tailwindcss/vite ` ([ #18948 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18948 ) )
2626- Re-throw errors from PostCSS nodes ([ #18373 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18373 ) )
2727- Detect classes in markdown inline directives ([ #18967 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18967 ) )
28+ - Ensure files with only ` @theme ` produce no output when built ([ #18979 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18979 ) )
2829
2930## [ 4.1.13] - 2025-09-03
3031
Original file line number Diff line number Diff line change @@ -5965,4 +5965,18 @@ describe('feature detection', () => {
59655965 expect ( compiler . features & Features . AtImport ) . toBeTruthy ( )
59665966 expect ( compiler . features & Features . Utilities ) . toBeFalsy ( )
59675967 } )
5968+
5969+ test ( 'using `@theme`' , async ( ) => {
5970+ let compiler = await compile ( css `
5971+ @theme {
5972+ --tracking-narrower : -0.02em ;
5973+ }
5974+ ` )
5975+
5976+ // We see @theme
5977+ expect ( compiler . features & Features . AtTheme ) . toBeTruthy ( )
5978+
5979+ // And this produces no output because no other CSS is present
5980+ expect ( compiler . build ( [ ] ) ) . toEqual ( '' )
5981+ } )
59685982} )
Original file line number Diff line number Diff line change @@ -133,6 +133,9 @@ export const enum Features {
133133
134134 // `@variant` was used
135135 Variants = 1 << 5 ,
136+
137+ // `@theme` was used
138+ AtTheme = 1 << 6 ,
136139}
137140
138141async function parseCss (
@@ -540,6 +543,8 @@ async function parseCss(
540543 if ( node . name === '@theme' ) {
541544 let [ themeOptions , themePrefix ] = parseThemeOptions ( node . params )
542545
546+ features |= Features . AtTheme
547+
543548 if ( context . reference ) {
544549 themeOptions |= ThemeOptions . REFERENCE
545550 }
You can’t perform that action at this time.
0 commit comments