Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Tailwind support? #2

Open
danlourenco opened this issue May 17, 2023 · 6 comments
Open

Tailwind support? #2

danlourenco opened this issue May 17, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@danlourenco
Copy link

danlourenco commented May 17, 2023

Hi there,

Great job with this addon! Wondering if this has been tested with Tailwind? I've followed whatever documentation I could find on Storybook 7 + Tailwind 3, but I can't get my Tailwind css to actually load in my stories. Any ideas?

@prnews-io-tech
Copy link
Contributor

Just install the following module: @storybook/addon-styling

And push it to your addons section:

addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    {
      name: '@storybook/addon-styling',
      options: {
        postCss: true,
      },
    },
    'storybook-addon-nuxt'
  ],

And then just import it inside your .storybook/preview.ts import '../assets/css/tailwind.css';

@danlourenco
Copy link
Author

@prnews-io I was doing just that, except in my preview.js file, I was importing the following:

import "tailwindcss/tailwind.css";
import "~/assets/css/main.css";

The tailwind.css file does not exist in the assets folder, and also I thought the options/postCss flag was unnecessary as that appears to be specific to webpack builds.

@hirotaka
Copy link
Owner

hirotaka commented Jun 8, 2023

Thanks for using the addon, and sorry for the late reply.
I just started exploring how to make Tailwindcss available in a simple setup.
I will let you know if there are any further improvements.

@hirotaka hirotaka self-assigned this Jun 8, 2023
@hirotaka hirotaka added the enhancement New feature or request label Jun 8, 2023
@daniel007enirman
Copy link

@danlourenco any solution did you find ?

@daniel007enirman
Copy link

i got solution

  1. Create Seperate post.config.js file
  2. import postcss-import in post.config.js @layer utilities is used but no matching @tailwind utilities directive is present. tailwindlabs/tailwindcss#5934 (reply in thread)

@woldtwerk
Copy link

I made a pr #23
this merges nuxt postcss config (also tailwind when using the nuxt tailwind addon) into storybook config.
You do not need @storybook/addon-styling or a custom postcss.config.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants