-
Notifications
You must be signed in to change notification settings - Fork 188
Change CLASS_NAME_PATTERN to work also for haml templates #38
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
Conversation
26aa897
to
083f851
Compare
Let's link this to #31, I almost got started on this not realizing you made moves already. Also, thanks for tackling it. ❤️ |
ugh, sorry about that I totally forgot to mention this PR in a comment in #31. I don't think I have the permission to link the issue as well... |
@wnm, do you think this will also work for slim templates? I would be happy using haml, but inherited a project that uses slim... |
yes, it should work, at least for the default configuration which is using the same syntax for class names as haml, e.g: |
Happy to see this adapted to the new purger. |
9f9cdda
to
e2786d7
Compare
@dhh done! I also added tests for slim syntax. it has a similar syntax (the same regex works), but better tailwind support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR changes the CLASS_NAME_PATTERN to work for haml templates.
Since haml syntax uses dots to chain class names, I first removed the dot from the search pattern...
But, to make sure it still works for decimal spacing classes (e.g.
my-1.5
), I added a pattern to allow dots which are preceded by a number between 0-3 and followed by a 5.By looking through the tailwind documentation, I think all the different class patterns are covered by a test already, so I'm not sure how to improve the test coverage... I'm happy to add more tests, but would need some input first, on what to test for...