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(
152152 }
153153 delete resolvedConfig . theme . aria
154154 }
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+ }
155167 }
156168
157169 // Convert theme values to CSS custom properties
@@ -389,7 +401,7 @@ const ALLOWED_THEME_KEYS = [
389401 // Used by @tailwindcss /container-queries
390402 'containers' ,
391403]
392- const BLOCKED_THEME_KEYS = [ 'supports' , 'data' ]
404+ const BLOCKED_THEME_KEYS = [ 'supports' ]
393405function onlyAllowedThemeValues ( theme : ThemeConfig ) : boolean {
394406 for ( let key of Object . keys ( theme ) ) {
395407 if ( ! ALLOWED_THEME_KEYS . includes ( key ) ) {
You can’t perform that action at this time.
0 commit comments