Skip to content

Tailwind doesn't pick up classes outside of strings #6331

@Munksgaard

Description

@Munksgaard

Environment

  • Elixir version (elixir -v): 1.18.4
  • Phoenix version (mix deps): 1.8.0-rc.3
  • Operating system: NixOS

Actual behavior

Putting tailwind utility classes in e.g. sigil_w means that the tailwindcss command line client doesn't pick them up.

I've created a demonstration repository here. Notice that the tagline on the front page is wrapped in a span that calls the foo/0 function to fill out the class attribute. foo/0 is defined here and uses ~w(bg-red-50) to return a list containing the string "bg-red-50". However, when running mix phx.server the text does not have a red background. If you instead change the line to ["bg-red-50"], the text has a red background as expected.

Expected behavior

Tailwind should also pick up utility classes defined outside of double-quotes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions