Closed kenchandev closed 10 months ago
Hi @kenchandev thanks for your PR! I will check it this afternoon. I think to mitigate these types of errors I will add tests for the regular expression.
I tested it and you are right. I will release a fix right now. The tests for the regex expression I can't make it now because I have holidays but when I return I will do it.
@all-contributors please add @kenchandev for bug
@RodrigoTomeES
I've put up a pull request to add @kenchandev! :tada:
Thanks for this awesome Astro integration!
When running this Astro integration on a project that uses TailwindCSS classes, I noticed that if I had two CSS classes in the project, for example,
h-2
andh-20
, then thematchClasses
regular expression with thekey
set toh-2
would match for instances ofh-20
(a valid CSS class). This would preventh-20
from being renamed properly.The update I made to the regular expression simply adds a negative lookahead assertion that ensures that the match is not followed by any alphanumeric, underscore or hyphen characters (valid characters in a CSS class).
Ideally, if the
key
is set toh-2
, then it should only renameh-2
, noth-20
,h-2a
,h-2_
, etc.