-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Bug]: tailwind styles not loading for a next.js app #27174
Comments
Did you run:
From the instructions? |
yes I did that. I did find a workaround in one of the issues where I modify the styling webpack addon not to tree shake |
I fixed it by setting this If you're facing issues with Tailwind CSS not being applied correctly in a Next.js project, you might need to adjust the module format of your PostCSS configuration file. Here are the steps to do so:
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
};
module.exports = config; details::
|
I tried doing the exact same thing, but it's still not working. Is there a way to debug the issue here? |
Thanks, but it was actually this postcss+monorepo issue: tailwindlabs/tailwindcss#8794 |
Describe the bug
I have a next app, and I ran the command
npx storybook@latest init
. Everything looks fine, and it ran when I didnpm run storybook
However, following the guide for Tailwind, I tried importing the global.css file in preview.tsx file, as recommended. My
preview.tsx
looks as follows:When I go to storybook, I don't see any of these styles applied. I looked for a stylesheet which could contain the tailwindcss classnames, but didn't find any
Inspecting the iframe that it was rendered in, I found the component
I would have expected to see those classnames somewhere in a stylesheet. I searched for
.flex
, but there was no styles. I searched through all of thestyle
tags and didn't see any that would be tailwind.cssFor a short term fix, I tried
import 'tailwindcss/tailwind.css'
instead, which, surprisingly, worked fine. However, this won't work for me because I have custom styles. Take for example the following configuration:And suppose I have a "link" component that is just an
a
tag. I will need this@layer components {}
directive to work to see it display correctly.To Reproduce
npx create-next-app@latest test-tailwind
npx storybook@latest init
.storybook/preview.tsx
, import the stylesheet undersrc/app/globals.css
. Make some changes to it for extra effectsrc/app/globals.css
, and some tailwind styles (such as.flex .flex-col
)System
The text was updated successfully, but these errors were encountered: