You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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
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,
In this case, the candidates extracted from
:gap-1.5
seem to be:gap-1
and5
, 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,To
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 candidategap-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.
The text was updated successfully, but these errors were encountered: