storybook-addon-next does not work with tailwindcss 3.
See original GitHub issueDescribe the bug
- tailwindcss3 works well when using
@storybook/addon-postcss(because tailwindcss3. needs postcss 8+. but storybook does not support postcss 8+.)
const path = require('path');
module.exports = {
stories: [
'../stories/**/*.stories.mdx',
'../stories/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
{
name: '@storybook/addon-postcss',
options: {
postcssLoaderOptions: {
implementation: require('postcss'),
},
},
},
],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-webpack5',
},
webpackFinal: async (config) => {
config.resolve.modules = [path.resolve(__dirname, '..'), 'node_modules'];
return config;
},
staticDirs: ['../public'],
};
- but, storybook-addon-next does not work with postcss 8+. 😦. please help.
const path = require('path');
module.exports = {
stories: [
'../stories/**/*.stories.mdx',
'../stories/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'storybook-addon-next',
{
name: '@storybook/addon-postcss',
options: {
postcssLoaderOptions: {
implementation: require('postcss'),
},
},
},
],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-webpack5',
},
webpackFinal: async (config) => {
config.resolve.modules = [path.resolve(__dirname, '..'), 'node_modules'];
return config;
},
staticDirs: ['../public'],
};
It occurs this error message.
Error: PostCSS plugin tailwindcss requires PostCSS 8.
Your minimal, reproducible example
https://github.com/kyujonglee/storybook-nextjs-tailwindcss
Steps to reproduce
- npx create-next-app@lasest --typescript
- npx storybook init
- install @storybook/addon-postcss and tailwindcss postcss autoprefixer.
Expected behavior
storybook nextjs tailwindcss3
work together.
How often does this bug happen?
No response
Screenshots or Videos
No response
Platform
- OS: macOS
- browser: Chrome
storybook-addon-next version
v1.6.4
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
tailwind 3 doesn't work with storybook/webpack setup #6314
Basically just do yarn and yarn storybook and you'll see storybook loaded correctly. ... you'll see no tailwind is loaded inside storybook.
Read more >Tailwind css classes not showing in Storybook build
When running build-storybook the components are rendered with the tailwind classes. Unfortunately, when I build storybook and run the create ...
Read more >How to set up Storybook with Next.js and Tailwind CSS
This step-by-step tutorial is written with Storybook v6.4.9 & TypeScript, if you found the tutorial is not working after some minor update, ...
Read more >storybook-addon-next - npm
A no config Storybook addon that makes Next.js features just work in Storybook. Latest version: 1.7.1, last published: 4 days ago.
Read more >Storybook Addon PostCSS
The Storybook PostCSS addon can be used to run the PostCSS preprocessor against your stories in Storybook. Getting Started. Install this addon by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Oh boy do I have good news for you.
If you go to the examples portion of the readme for this addon, you will see that I have a tailwind css 3 example.
In short, you don’t need the storybook postcss addon 😃
Hope this helps
Yup! no problem!