Skip to content

Candidate extraction from Clojure/Script files sometimes produce false negatives #17760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eneroth opened this issue Apr 23, 2025 · 0 comments

Comments

@eneroth
Copy link

eneroth commented Apr 23, 2025

What version of Tailwind CSS are you using?

v4.1.4

What build tool (or framework if it abstracts the build tool) are you using?

postcss-cli 11.0.1

What version of Node.js are you using?

v23.11.0

What browser are you using?

Chrome, Safari, Firefox

What operating system are you using?

macOS

Reproduction URL

#17087

Image

Describe your issue

First of all, a huge thank you for including Clojure.

The issue stems from classes written as keywords that contain fractions. For example,

($ :div {:class [:flex :gap-1.5 :p-1]} …)

In this case, the candidates extracted from :gap-1.5 seem to be :gap-1 and 5, which will end up not matching any class present in the compiled HTML: <div class="flex gap-1.5 p-1">…</div>.

A suggested "good enough" solution is to, in addition to considering the keyword when broken down by period (.) separation, additionally consider the whole string as a candidate. I.e. such that it goes from considering the candidates,

["gap-1" "5"]

To

["gap-1" "5" "gap-1.5"]

This may end up producing some valid classes which are not actually present in the code (gap-1 in this case), but is still preferable, as it trades precision for accuracy.

Another, more elaborate solution would be to join candidates pair-wise and accept them iff they produce a valid class. Eg., the candidates ["gap-1" "5" "p-1"] are extracted. When the first pair is joined with ., they produce the candidate gap-1.5, which is therefore accepted in place of the previous two candidates, producing ["gap-1.5" "p-1"]. In the next iteration, the join produces ["gap-1.5.p-1"], which is nonsense, and is therefore rejected.

More discussion can be found towards the end of #17087.

@eneroth eneroth changed the title Class extraction from Clojure/Script files sometimes produce false negatives Candidate extraction from Clojure/Script files sometimes produce false negatives Apr 23, 2025
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

No branches or pull requests

1 participant