Skip to content

Conversation

thecrypticace
Copy link
Contributor

It’s perfect since the AST doesn’t actually have information on these (it’s just strings) but this should be good enough.

Fixes #323

It’s perfect since the AST doesn’t actually have information on these (it’s just strings) but this should be good enough.
Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it with:

t`@apply ~"absolute top-[80px] right-[20px] z-10 flex items-center";`,

Which fails with the " in the wrong spot before this fix. And works with the " in the correct spot (and properly sorted classes) after the fix.

@RobinMalfait
Copy link
Member

You might want to run prettier:

diff --git a/tests/tests.ts b/tests/tests.ts
index f4f8be5..bcff661 100644
--- a/tests/tests.ts
+++ b/tests/tests.ts
@@ -266,7 +266,12 @@ export let tests: Record<string, TestEntry[]> = {
     t`@apply ${yes} #{'''!important'''};`,
     t`@apply ${yes} #{"'"'"!important"'"'"};`,
   ],
-  less: [...css, t`@apply ${yes} !important;`, t`@apply ~"${yes}";`, t`@apply ~'${yes}';`],
+  less: [
+    ...css,
+    t`@apply ${yes} !important;`,
+    t`@apply ~"${yes}";`,
+    t`@apply ~'${yes}';`,
+  ],
   babel: javascript,
   typescript: javascript,
   'babel-ts': javascript,

@thecrypticace thecrypticace merged commit c3c5ff5 into main Aug 29, 2025
1 check passed
@thecrypticace thecrypticace deleted the fix/less-apply-sorting branch August 29, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When I use custom styles in CSS/LESS files, formatting will make an error

2 participants