Skip to content
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

Fix class detection in Slim templates with attached attributes and IDs #14019

Merged
merged 3 commits into from
Jul 18, 2024

Conversation

thecrypticace
Copy link
Contributor

This PR brings back a tweaked version of our "inner matches" regex so the m*-auto classes in the following Slim template will be properly detected:

.ml-auto[
  data-value='foo'
]
  Foo bar
.mr-auto[data-value='foo']
  Foo bar
.mt-auto#omg
  Foo bar
#omg.mb-auto
  Foo bar

The regex isn't identical to the previous one because we still want to prevent things like px-1.5 from detecting both px-1 and px-1.5.

Fixes #14013

@adamwathan adamwathan merged commit bdc87ae into master Jul 18, 2024
13 checks passed
@adamwathan adamwathan deleted the fix/v3-slim-classes branch July 18, 2024 15:21
@ArnaudBarre
Copy link

ArnaudBarre commented Jul 25, 2024

Hello! Just wanted to let you know that by adding . to left border and #[ to right border in https://github.com/ArnaudBarre/downwind/blob/main/src/utils/regex.ts#L59-L63 this four cases passes. And I don't have any issues with px-1.5 after adding that this is a possible value (long live px based size config). I really love how lookahead and lookbehind is making it possible to get everything in one regex (I think one regex per file type would be ideal).

@thecrypticace
Copy link
Contributor Author

Yeah regex lookbehind wasn't supported until Safari 16.4 annoyingly which is why we don't use it (b/c CDN and Play). Won't matter in the future though.

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.

3 participants