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 @@ -152,6 +152,18 @@ async function migrateTheme(
152
152
}
153
153
delete resolvedConfig . theme . aria
154
154
}
155
+
156
+ if ( 'data' in resolvedConfig . theme ) {
157
+ for ( let [ key , value ] of Object . entries ( resolvedConfig . theme . data ?? { } ) ) {
158
+ // Will be handled by bare values if the names match.
159
+ // E.g.: `data-foo:flex` should produce `[data-foo]`
160
+ if ( key === value ) continue
161
+
162
+ // Create custom variant
163
+ variants . set ( `data-${ key } ` , `&[data-${ value } ]` )
164
+ }
165
+ delete resolvedConfig . theme . data
166
+ }
155
167
}
156
168
157
169
// Convert theme values to CSS custom properties
@@ -389,7 +401,7 @@ const ALLOWED_THEME_KEYS = [
389
401
// Used by @tailwindcss /container-queries
390
402
'containers' ,
391
403
]
392
- const BLOCKED_THEME_KEYS = [ 'supports' , 'data' ]
404
+ const BLOCKED_THEME_KEYS = [ 'supports' ]
393
405
function onlyAllowedThemeValues ( theme : ThemeConfig ) : boolean {
394
406
for ( let key of Object . keys ( theme ) ) {
395
407
if ( ! ALLOWED_THEME_KEYS . includes ( key ) ) {
You can’t perform that action at this time.
0 commit comments