-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Thank you for an awesome tool! I've been using it in all my projects recently and the productivity gains have been immense.
What version of Tailwind CSS are you using?
Tailwind v3.2.4
What build tool (or framework if it abstracts the build tool) are you using?
postcss: 8.4.19, postcss-cli 10.0.0
What version of Node.js are you using?
Node v16.18.1
What browser are you using?
Firefox
What operating system are you using?
macOS
Reproduction URL
I have added a test case that fails, showing the incorrect behaviour. This is the first time I've popped the hood on Tailwind, so forgive me if the regexes I've linked are the incorrect ones.
Describe your issue
We're using Ruby on Rails with Tailwind and use the Ruby percent string syntax to generate arrays.
Something like %w[text-[#bada55]] becomes ["text-[#bada55]"] in Ruby.
The following ERB code doesn't correctly generate the arbitrary value Tailwind class:
<%= content_tag(:div, class: %w[text-[#bada55]]) {} %>However, this does work:
<%= content_tag(:div, class: ["text-[#a55bad]"]) {} %>As noted in my commit above, I think this is due to the extra closing square bracket tripping up the regex here1 but my knowledge of Tailwind's internals is very vague.
I'm not sure if there's a way to fix this or not, as I appreciate that handling extremely specific scenarios like this is a direction the project might not want to head in. But maybe there's a quick fix? Thanks for checking this issue out, anyway 😄