Skip to content

Commit 3b636b7

Browse files
authored
Mark break-words as deprecated, and upgrade to wrap-break-word (#19157)
This PR marks `break-words` as deprecated (such that intellisense doesn't suggest it anymore). Updates the upgrade tooling to prefer `wrap-break-word` instead. Note: `break-words` will still work as expected. ## Test plan 1. `break-words` still generates the correct CSS. 2. Intellisense doesn't suggest `break-words` anymore. 3. Upgrade tooling suggests `wrap-break-word` instead of `break-words`.
1 parent fb0f432 commit 3b636b7

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- Don’t index into strings with the `theme(…)` function ([#19111](https://github.com/tailwindlabs/tailwindcss/pull/19111))
2626
- Fix parsing issue when `\t` is used in at-rules ([#19130](https://github.com/tailwindlabs/tailwindcss/pull/19130))
2727
- Upgrade: Canonicalize utilities containing `0` values ([#19095](https://github.com/tailwindlabs/tailwindcss/pull/19095))
28+
- Upgrade: Migrate deprecated `break-words` to `wrap-break-word` ([#19157](https://github.com/tailwindlabs/tailwindcss/pull/19157))
2829

2930
## [4.1.14] - 2025-10-01
3031

packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3606,7 +3606,6 @@ exports[`getClassList 1`] = `
36063606
"break-inside-avoid-page",
36073607
"break-keep",
36083608
"break-normal",
3609-
"break-words",
36103609
"brightness-0",
36113610
"brightness-50",
36123611
"brightness-75",

packages/tailwindcss/src/canonicalize-candidates.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,32 @@ describe.each([['default'], ['with-variant'], ['important'], ['prefix']])('%s',
531531

532532
await expectCanonicalization(input, candidate, expected)
533533
})
534+
535+
test('`break-words` → `wrap-break-word`', async () => {
536+
let candidate = 'break-words'
537+
let expected = 'wrap-break-word'
538+
539+
let input = css`
540+
@import 'tailwindcss';
541+
`
542+
543+
await expectCanonicalization(input, candidate, expected)
544+
})
545+
546+
test('`break-words` → `break-words` with custom implementation', async () => {
547+
let candidate = 'break-words'
548+
let expected = 'break-words'
549+
550+
let input = css`
551+
@import 'tailwindcss';
552+
553+
@utility break-words {
554+
break: words; /* imagine this exists */
555+
}
556+
`
557+
558+
await expectCanonicalization(input, candidate, expected)
559+
})
534560
})
535561

536562
describe('arbitrary variants', () => {

packages/tailwindcss/src/canonicalize-candidates.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,10 @@ function bareValueUtilities(candidate: Candidate, options: SignatureOptions): Ca
878878

879879
// ----
880880

881-
const DEPRECATION_MAP = new Map([['order-none', 'order-0']])
881+
const DEPRECATION_MAP = new Map([
882+
['order-none', 'order-0'],
883+
['break-words', 'wrap-break-word'],
884+
])
882885

883886
function deprecatedUtilities(candidate: Candidate, options: SignatureOptions): Candidate {
884887
let designSystem = options.designSystem

packages/tailwindcss/src/compat/legacy-utilities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,5 @@ export function registerLegacyUtilities(designSystem: DesignSystem) {
9292
})
9393

9494
designSystem.utilities.static('order-none', () => [decl('order', '0')])
95+
designSystem.utilities.static('break-words', () => [decl('overflow-wrap', 'break-word')])
9596
}

packages/tailwindcss/src/utilities.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,6 @@ export function createUtilities(theme: Theme) {
21562156
['overflow-wrap', 'normal'],
21572157
['word-break', 'normal'],
21582158
])
2159-
staticUtility('break-words', [['overflow-wrap', 'break-word']])
21602159
staticUtility('break-all', [['word-break', 'break-all']])
21612160
staticUtility('break-keep', [['word-break', 'keep-all']])
21622161

0 commit comments

Comments
 (0)