Changed
- Sort a class with a pseudo-class variant, such as
hover:bg-w, by its own
position in the CSS file in--output-css-fileand--vite-css. It no longer
goes in the variant group after the known classes. - Read hand-written CSS with the same rule.
.card .title {now registers
title. It registeredcardbefore..btn:hover {now registersbtn. It
registeredbtn:hoverbefore.
Fixed
- Read the class order in
--output-css-fileand--vite-csswith a CSS scan
instead of a line regex. The scan finds the classes of rules that do not start
with.class {, such as:where(.divide-y > :not(:last-child)) {, and of
selectors that end in a pseudo-class, such as.hover\:bg-well:hover {.
Tailwind CSS 4.3.3 and later emit these flat rules in unminified output,
#167,
#168, thanks
@NoobInTheNet - Decode the JSON string that Vite puts around the CSS (the output of
JSON.stringify) in--vite-cssbefore reading the class order. The line
regex read only the first rule of that one-line text. - Decode hexadecimal CSS escapes in the class names.
.\32xl\:blocknow gives
2xl:block. It gave32xl:blockbefore. - Read a rule written without a space before
{, such as.a{. The line regex
skipped it.
Breaking changes
- In
--output-css-fileand--vite-css, classes that the CSS file does not
define now come first, in their input order, as in the built-in sorter and in
prettier-plugin-tailwindcss. They came last before. The placeholders...
and…now go last. The output of these options changes, so
--check-formattedreports files with custom classes after the upgrade, until
you run--write. A class such ashover:flexthat the CSS does not define,
but whose part after the first built-in variant prefix it does, goes after
the defined classes,
#169, thanks
@NoobInTheNet