Reputation: 63
I'm encountering an issue with TailwindCSS in my Symfony project that used to work perfectly until I re-ran the build today. Suddenly, the build process downloaded TailwindCSS v4, and now none of my styles are displaying on the site.
My Setup
symfonycasts/tailwind-bundle
(previously working)php bin/console tailwind:build --watch
assets/app.js
includes:import './styles/app.css';
and my assets/styles/app.css
contains:
@tailwind base;
@tailwind components;
@tailwind utilities;
@font-face {
font-family: 'Memoirs';
src: url('/fonts/Mouse_Memoirs/MouseMemoirs-Regular.ttf') format('truetype');
}
I can confirm that my CSS is being correctly interpreted (e.g., classes are recognized in the browser dev tools), so the issue appears to stem solely from Tailwind.
What Happened
Until yesterday, everything was working as expected. Today, when I re-launched the build command, the process downloaded TailwindCSS version 4 (v4.0.3 for Windows x64). The output from the build command is similar to:
! [NOTE] Executing Tailwind (pass -v to see more details).
Command: C:\Path\to\project/var/tailwind/v4.0.3/tailwindcss-windows-x64.exe -c C:\Path\to\project/tailwind.config.js -i C:\Path\to\project/assets/styles/app.css -o C:\Path\to\project/var/tailwind/tailwind.built.css --watch
≈ tailwindcss v4.0.3
Done in 106ms
However, even though the build completes successfully, no Tailwind styles are applied on my site.
What I've Tried
var/tailwind/tailwind.built.css
, but I'm not using this file directly because I rely on Importmap to load my assets.app.js
correctly imports app.css
, and the CSS file contains the Tailwind directives.Question
Has anyone encountered a similar issue where updating to TailwindCSS v4 causes no styles to appear in a Symfony project using Importmap? Is there a known compatibility issue or a change in Tailwind v4 that might explain this behavior? Any help or pointers on how to troubleshoot this would be greatly appreciated.
Upvotes: 1
Views: 279
Reputation: 8315
Since you mentioned that you are using this package, I thought it was important to check whether they have implemented the necessary changes for the TailwindCSS v4 release. Here's what I found:
SymfonyCasts/tailwind-bundle
#81: TailwindCSS v4 support - GitHubSymfonyCasts/tailwind-bundle
PR #86: Proposal to fix Tailwind CSS v4 supportYou can temporarily use TailwindCSS v3, but TailwindBundle will install the latest version by default.
This sets the default version to 3.4.17 (the latest on the 3.x branch). This is temporary until 4.0 is supported.
Source:
SymfonyCasts/tailwind-bundle
PR #83: fix: default to latest Tailwind CSS v3.x
Regardless of the package, it's a good idea to familiarize yourself with the changes as well.
Removed @tailwind directives
In v4 you import Tailwind using a regular CSS
@import
statement, not using the@tailwind
directives you used in v3:Not supported from v4
@tailwind base; @tailwind components; @tailwind utilities;
Supported from v4
@import "tailwindcss";
Upvotes: 0