Skip to content

Infinite rendering with Webpack Encore from Symfony 7.2 and Tailwindcss 4.1.3 #17589

Answered by Zhartas
mowabidev asked this question in Help
Discussion options

You must be logged in to vote

Hi,
I had the same issue with Tailwind CSS 4.1 in a Symfony project: Webpack Encore was endlessly recompiling files.

After some digging, I found the problem came from Tailwind CSS’s new automatic content detection. It scans all files — including those in the public/ directory, which contains compiled assets — causing an infinite loop.

✅ Solution:

In your main CSS file (e.g., app.css), add this line to exclude the public/ directory from scanning:

@source not "../../public/*";

Adjust the path depending on where your CSS file is located.

Since Tailwind v4, you can define sources directly in your CSS using @source, and exclude folders using @source not.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mowabidev
Comment options

Answer selected by mowabidev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #17579 on April 07, 2025 11:05.