-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
JIT includes quotes in class names when classes are followed by '
and ]
characters
#4801
Comments
Hey! This is a tough one — what you are seeing there is how we support classes like this: <div class="content-[']']"> https://play.tailwindcss.com/8zudTG6Nal Not sure what the right trade off to make here in ambiguous situations, especially given the constraint that this has to be achievable with a regex to be as universal and simple as possible. Any suggestions on heuristics we can use to determine when yo keep the quote/square bracket and when not to? 🤔 |
Oh cool, that makes a lot of sense. I didn't realize Are quote characters inside the brackets valid/useful for any utilities other than What are the regexes the JIT engine uses to match class names with dynamic values like this? I looked around and found a couple but none seemed to actually work against Adding a trailing space for now feels like a more than fair workaround. I'll keep thinking about it but feel free to close this if it's not a priority 👍🏻 thanks! |
Pushed some improvements over at #4817 that I think will help out here 👍🏻 I'll try and get an insiders build out today once CI passes and I can merge it to so you can start playing with that. |
Love it 🦾 thanks! |
What version of Tailwind CSS are you using?
v2.2.4
What build tool (or framework if it abstracts the build tool) are you using?
Tailwind CLI
What version of Node.js are you using?
v16.2.0
What browser are you using?
Firefox (v89.0.2)
What operating system are you using?
macOS (11.4)
Reproduction repository
https://github.com/bakerkretzmar/tailwindcss-jit-quotes-repro
Describe your issue
If an arbitrary value in a class name is immediately followed by a single quote mark and another closing bracket, the quote and bracket are included in the generated class name.
For example, this markup:
generates this CSS:
The string
['class' => 'max-w-[16rem]']
seems to be the issue, specifically the fact that it ends with]']
. It looks like the JIT engine stops at the second]
, interpreting the arbitrary value for the CSS property to be16rem]'
.Adding a space before those characters (
['class' => 'max-w-[16rem] ']
) 'fixes' the issue and produces valid CSS.The text was updated successfully, but these errors were encountered: