File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/@tailwindcss-upgrade/src/codemods/config Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,18 @@ async function migrateTheme(
153153 }
154154 delete resolvedConfig . theme . aria
155155 }
156+
157+ if ( 'data' in resolvedConfig . theme ) {
158+ for ( let [ key , value ] of Object . entries ( resolvedConfig . theme . data ?? { } ) ) {
159+ // Will be handled by bare values if the names match.
160+ // E.g.: `data-foo:flex` should produce `[data-foo]`
161+ if ( key === value ) continue
162+
163+ // Create custom variant
164+ variants . set ( `data-${ key } ` , `&[data-${ value } ]` )
165+ }
166+ delete resolvedConfig . theme . data
167+ }
156168 }
157169
158170 // Convert theme values to CSS custom properties
@@ -401,7 +413,7 @@ const ALLOWED_THEME_KEYS = [
401413 // Used by @tailwindcss /container-queries
402414 'containers' ,
403415]
404- const BLOCKED_THEME_KEYS = [ 'supports' , 'data' ]
416+ const BLOCKED_THEME_KEYS = [ 'supports' ]
405417function onlyAllowedThemeValues ( theme : ThemeConfig ) : boolean {
406418 for ( let key of Object . keys ( theme ) ) {
407419 if ( ! ALLOWED_THEME_KEYS . includes ( key ) ) {
You can’t perform that action at this time.
0 commit comments