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(
153
153
}
154
154
delete resolvedConfig . theme . aria
155
155
}
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
+ }
156
168
}
157
169
158
170
// Convert theme values to CSS custom properties
@@ -401,7 +413,7 @@ const ALLOWED_THEME_KEYS = [
401
413
// Used by @tailwindcss /container-queries
402
414
'containers' ,
403
415
]
404
- const BLOCKED_THEME_KEYS = [ 'supports' , 'data' ]
416
+ const BLOCKED_THEME_KEYS = [ 'supports' ]
405
417
function onlyAllowedThemeValues ( theme : ThemeConfig ) : boolean {
406
418
for ( let key of Object . keys ( theme ) ) {
407
419
if ( ! ALLOWED_THEME_KEYS . includes ( key ) ) {
You can’t perform that action at this time.
0 commit comments