You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I want to hear if anyone has been entered a case like me.
I was working on a simple project for storybook generating by next@latest --template typescript and the thing I firstly did was installing storybook and initiating it with tailwind css. globals.css was located right under app dir, so storybook preview should getting it like import '../app/globals.css'; to make it in use.
After generating few storybook components, I faced a problem that tailwind is not working with another components under /app or /src at all.
Here's few code at that moment.
As you can see above, globals.css is correctly imported to app/layout.tsx but
<p className="text-xs underline">dd</p>
is never applied.
There were 2 weird points.
As per margin: 0; padding: 0; has been correctly showing up in page.tsx components, then why tailwind preflight didn't?
How can it be applied to storybook, but how can it not be applied to general components?
I had to spend a lot of time to fix this problem and found a solution finally.
a) change extension of globals.css to globals.scss and installed sass
b) change extension of postcss.config.ts to postcss.config.js
Now Tailwind is properly working with general components, But I still do not have any idea why it happened and how was that 2 solutions working. ...
I know this got long text to read, but hope to be heard something from someone.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I want to hear if anyone has been entered a case like me.
I was working on a simple project for storybook generating by
next@latest --template typescript
and the thing I firstly did was installing storybook and initiating it with tailwind css.globals.css
was located right underapp dir
, so storybook preview should getting it likeimport '../app/globals.css';
to make it in use.After generating few storybook components, I faced a problem that tailwind is not working with another components under
/app
or/src
at all.Here's few code at that moment.
package.json
tailwind.config.ts
postcss.config.ts
tsconfig.json
app/globals.css
app/layout.tsx
app/page.tsx*
As you can see above,
globals.css
is correctly imported toapp/layout.tsx
butis never applied.
There were 2 weird points.
margin: 0; padding: 0;
has been correctly showing up inpage.tsx
components, then why tailwind preflight didn't?I had to spend a lot of time to fix this problem and found a solution finally.
a) change extension of
globals.css
toglobals.scss
and installedsass
b) change extension of
postcss.config.ts
topostcss.config.js
Now Tailwind is properly working with general components, But I still do not have any idea why it happened and how was that 2 solutions working. ...
I know this got long text to read, but hope to be heard something from someone.
Beta Was this translation helpful? Give feedback.
All reactions