Oh my god, just banged my head for a few hours to understand that this is happening.
The thing is that this is not only not consistent, if you use same classes elsewhere, it will work (this also includes cached builds), but it also doesn’t show any kind of errors or warnings.
Actually as it currently stands, it seems that the limitation is that the string should be known at compile-time, things such as this work:
<div class={[@badge_type]}>
</div>
badge_type = get_badge(type)
assign(socket, badge_type: badge_type)
defp badge_type (type) do
case type do
:success -> "badge-success"
:warning -> "badge-warning"
:error -> "badge-error"
:inactive -> "badge-ghost"
:not_found -> "badge-info"
end
end
I have both the cases where a separate .heex file is used and when render/1 from an .ex file is used, and both seem to be working when the strings are known at compile-time. Looking at this now, it seems that the configuration watches in .ex files too:
content = [
...
"../lib/*_web/**/*.*ex"
]
Have you found any solutions so somebody else would not stumble onto this bug?






















