Next.js and Tailwind: New Classes Not Automatically Loaded into Stylesheet
Unanswered
Maltese posted this in #help-forum
MalteseOP
Hello! I’m encountering a strange issue and I hope you can help me. I'm using Next.js 15 with Tailwind, and I’ve noticed that when I add a new class, like px-10, that I haven't used before in my project, it doesn’t trigger Next.js or Tailwind to generate a new stylesheet. As a result, the px-10 class doesn’t appear in the old stylesheet, and the style isn’t applied to my element. However, when I modify the content of an HTML element, Next.js seems to hot reload and correctly fetch the new stylesheet that includes the px-10 class. I’m not sure why this doesn’t happen immediately when I add a new class. Any help would be appreciated! 🙂
3 Replies
West African Lion
It seems Tailwind CSS problem. So did you encounter this problem after updating the next.js version to 15?
Polar bear
Is the tailwind config file taking into account the file path of the file your are working on?
Asian black bear
If you happen to use Safari, it's a known issue with Safari caching CSS aggressively.