Repository navigation
How to conditionally add styles for specific files #5175
Unanswered
tylersayshi
asked this question in
Help
Replies: 1 comment 2 replies
|
Hey! Have you tried rewriting your ternary logic "outside" of the glob? purge: process.env.SB ? ['./src/**/*.{ts,tsx}'] : ['./src/**/!(*.stories).{ts,tsx}']You can also probably use the |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I am currently creating a component library where I am using tailwind & storybook. Currently, I am using the JIT mode and any tailwind classes that I add to *.stories.tsx files get put into the final styles for my storybook. This is good for when I am running storybook or building it, but when I run build for the component library I would like to exclude any classes in .stories.tsx files.
My first attempt to do this was to try to exclude stories files in the purge field like this:
If this worked I would create an environment variable for when storybook is being used to add those files as well
Unfortunately, the glob that was meant to exclude stories files was not doing what I was hoping it would and was still including classes in my final build from .stories.tsx files.
Does anyone know if I am missing something? Is there something else I need to set to exclude certain files? Thanks in advance for any help.
Edit: The specific issue here is that
'./src/**/!(*.stories).{ts,tsx}'is still including files with the.stories.tsxextension.All reactions