Skip to content

Tailwind v4 doesn't see classes in EJS templates #17940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
iliakan opened this issue May 8, 2025 · 8 comments
Open

Tailwind v4 doesn't see classes in EJS templates #17940

iliakan opened this issue May 8, 2025 · 8 comments

Comments

@iliakan
Copy link

iliakan commented May 8, 2025

EJS template files aren't parsed.

There's no such extension .ejs in the list.
It's like HTML, should we just add it?

@wongjn
Copy link
Collaborator

wongjn commented May 8, 2025

#17845 is about Tailwind v4 gradient CSS not compatible with v3 gradient CSS - I'm not sure what relevance it has to your question. Furthermore, could you elaborate on what you mean by "the list" please? You may also wish to review https://tailwindcss.com/docs/detecting-classes-in-source-files#which-files-are-scanned if you have not already done so.

@iliakan
Copy link
Author

iliakan commented May 9, 2025

@wongjn

Thank you for the information about another problem.

However, in my case, the class p-6 is absent in the resulting build, even though it's in EJS templates.
Perhaps, EJS files aren't scanned.

By "the list", I mean crates/oxide/src/scanner/fixtures/template-extensions.txt.

The file with .ejs extension isn't there, I made a pull request #17941 to add it.
It's just a guess though 😀

@wongjn
Copy link
Collaborator

wongjn commented May 9, 2025

Consider providing a git repo that reproduces the unexpected behavior, so that we can troubleshoot what the root cause may be.

@iliakan
Copy link
Author

iliakan commented May 9, 2025

@wongjn as for now, I went back to v3.

But I believe you have a list of extensions to be scanned, and .ejs just isn't there 😀
So should be very simple, unless I'm mistaken about the process.

@wongjn
Copy link
Collaborator

wongjn commented May 9, 2025

Those extensions aren't the only files that are scanned. See https://tailwindcss.com/docs/detecting-classes-in-source-files#which-files-are-scanned for details.

@philipp-spiess
Copy link
Member

@iliakan Yeah these list is only there to generate default glob watchers for projects that have no files yet I believe, so adding it to that list will not change anything about .ejs. Do you mind posting the .ejs file in question here so we can take a look?

@iliakan
Copy link
Author

iliakan commented May 9, 2025

Oh, good to know.
I wanted to check the actually scanned files, but the code just made it to the repo, couldn't build it.
Any way to simply install the latest repo without building it? ;)

The index.ejs was like ...<div class="p-6 space-y-6">...</div>..., and p-6 wasn't in the resulting styles.

@philipp-spiess
Copy link
Member

We really need the full file here at least to check, this snippet seems to extract fine on unknown file extensions:

Image

Are no utilities at all being extracted? If that's the case, maybe your content discovery is not set up correctly. Again, a repro here would be necessary for us to help out further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants