Skip to content

Commit 6ccb843

Browse files
add comment that there could be a behavior change
Co-Authored-By: Jordan Pittman <[email protected]>
1 parent 4fe4301 commit 6ccb843

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

integrations/upgrade/js-config.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,13 @@ test(
10181018
--- src/input.css ---
10191019
@import 'tailwindcss';
10201020
1021+
/*
1022+
These variants have been migrated from your Tailwind CSS configuration file.
1023+
Since they are custom variants, they will be sorted after all built-in variants.
1024+
1025+
This may result in elements appearing different if you were relying on the order of
1026+
the variants in the CSS.
1027+
*/
10211028
@custom-variant aria-bar (&[aria-baz="true"]);
10221029
@custom-variant aria-asc (&[aria-sort="ascending"]);
10231030
@custom-variant aria-desc (&[aria-sort="descending"]);

packages/@tailwindcss-upgrade/src/codemods/config/migrate-js-config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Scanner } from '@tailwindcss/oxide'
2+
import dedent from 'dedent'
23
import fs from 'node:fs/promises'
34
import path from 'node:path'
45
import { fileURLToPath } from 'node:url'
@@ -223,6 +224,17 @@ async function migrateTheme(
223224

224225
if (variants.size > 0) {
225226
css += '\n@tw-bucket custom-variant {\n'
227+
228+
css += dedent`
229+
/*
230+
These variants have been migrated from your Tailwind CSS configuration file.
231+
Since they are custom variants, they will be sorted after all built-in variants.
232+
233+
This may result in elements appearing different if you were relying on the order of
234+
the variants in the CSS.
235+
*/
236+
`
237+
226238
for (let [name, selector] of variants) {
227239
css += `@custom-variant ${name} (${selector});\n`
228240
}

0 commit comments

Comments
 (0)