-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Closed
Description
What version of Tailwind CSS are you using?
v4.1.18
What build tool (or framework if it abstracts the build tool) are you using?
tailwindcss-rails
What browser are you using?
N/A
What operating system are you using?
macOS
Reproduction URL
https://github.com/eelcoj/explicit-locals
Describe your issue
Rails has a feature (since 7.2?) called explicit locals. Syntax is: <%# locals: (css: "text-amber-600") %>
In above repo this code:
<%# locals: (css: "text-amber-600") %>
<% more_css = "text-sky-500" %>
<p class="text-green-500">
In a partial
</p>
<p class="<%= css %>">
In a partial using explicit local variables
</p>
<p class="<%= more_css %>">
In a partial using explicit local variables
</p>Renders as:
You can see the before last, is not getting the text-amber-600.
My guess is Tailwind assumes it is a comment, thus skips the parsing of the line? There is point to be made that this is expected: “strict locals are only meant to pass objects”. But I often use it to pass CSS and then use it to set defaults.
coderabbitai
Metadata
Metadata
Assignees
Labels
No labels
