mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Migrate grid-cols-[subgrid] and grid-rows-[subgrid] to grid-cols-subgrid and grid-rows-subgrid (#14840)
This PR adds a migration to convert `grid-cols-[subgrid]` to `grid-cols-subgrid` and `grid-rows-[subgrid]` to `grid-rows-subgrid`.
This commit is contained in:
parent
cf77420b0c
commit
baed3aabe2
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- _Upgrade (experimental)_: Migrate `grid-cols-[subgrid]` and `grid-rows-[subgrid]` to `grid-cols-subgrid` and `grid-rows-subgrid` ([#14840](https://github.com/tailwindlabs/tailwindcss/pull/14840))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Detect classes in new files when using `@tailwindcss/postcss` ([#14829](https://github.com/tailwindlabs/tailwindcss/pull/14829))
|
||||
|
||||
@ -8,6 +8,9 @@ test.each([
|
||||
['col-start-[7]', 'col-start-7'],
|
||||
['flex-[2]', 'flex-2'], // `flex` is implemented as static and functional utilities
|
||||
|
||||
['grid-cols-[subgrid]', 'grid-cols-subgrid'],
|
||||
['grid-rows-[subgrid]', 'grid-rows-subgrid'],
|
||||
|
||||
// Only 50-200% (inclusive) are valid:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-stretch#percentage
|
||||
['font-stretch-[50%]', 'font-stretch-50%'],
|
||||
|
||||
@ -14,6 +14,21 @@ export function arbitraryValueToBareValue(
|
||||
let clone = structuredClone(candidate)
|
||||
let changed = false
|
||||
|
||||
// Convert [subgrid] to subgrid
|
||||
if (
|
||||
clone.kind === 'functional' &&
|
||||
clone.value?.kind === 'arbitrary' &&
|
||||
clone.value.value === 'subgrid' &&
|
||||
(clone.root === 'grid-cols' || clone.root == 'grid-rows')
|
||||
) {
|
||||
changed = true
|
||||
clone.value = {
|
||||
kind: 'named',
|
||||
value: 'subgrid',
|
||||
fraction: null,
|
||||
}
|
||||
}
|
||||
|
||||
// Convert utilities that accept bare values ending in %
|
||||
if (
|
||||
clone.kind === 'functional' &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user