Runtime Tailwind CSS Compilation Not Working After v4.1 Update #18356
-
Hi Tailwind team 👋, I’m running into issues with runtime compilation after upgrading to Tailwind CSS v4.1. Previously on v3, I used PostCSS to generate Tailwind styles dynamically at runtime based on API data (e.g., JSON themes). Here's a simplified version of my GET handler
This worked fine in Tailwind v3, but now with v4.1, the same logic no longer works. Is there something that changed in v4.1 regarding runtime usage or PostCSS integration that would cause this to break? Any guidance would be greatly appreciated! Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Yes, as the major version increment would imply, the API for the PostCSS plugin is completely different: tailwindcss/packages/@tailwindcss-postcss/src/index.ts Lines 50 to 56 in c5a997c
You'd want to migrate to the CSS configuration style: @layer theme, base, components, utilities;
@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/utilities.css" layer(utilities) source(none);
@import "./path/to/theme.css";
@source "./public/runtime-theme.json"; |
Beta Was this translation helpful? Give feedback.
-
Related: |
Beta Was this translation helpful? Give feedback.
Related: