Skip to content

Tailwind v4 is not seeing classes in slim templates #17334

@Lukom

Description

@Lukom

What version of Tailwind CSS are you using?

v4.0.14

What build tool (or framework if it abstracts the build tool) are you using?

I'm using Ruby on Rails with gem tailwindcss-rails v4.2.1

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

Tell me if it's really needed, because it takes time to setup such example.

Describe your issue

I'm trying to upgrade to Tailwing V4, but new Tailwind doesn't see classes in my templates. Tailwind v3 was seeing classes successfully.

In my project I use Slim Templates with view_component gem.

This works:

class QweComponent < ApplicationComponent
  slim_template <<~SLIM
    button.rounded-full
      | Some text
  SLIM
end

after calling bin/rails tailwindcss:build class rounded-full was added to generated tailwind.css file.

But this doesn't work:

class QweComponent < ApplicationComponent
  slim_template <<~SLIM
    button.rounded-full.qwe
      | Some text
    button.rounded-full(
      class="qwe"
    )
      | Some text
  SLIM
end

class rounded-full was not added to generated tailwind.css file. It happens because rounded-full is followed by . or (. I suppose the same happens with HAML templates, other similar templating language.

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