Extend theme classes not included in rollup tailwind build #11562
Unanswered
chrisj-skinner
asked this question in
Help
Replies: 1 comment
-
I faced a similar issue with Tailwind’s extend values (like custom colors) not making it into the final build when using Rollup to package a UI component library. What worked for me: I resolved this by building the library first, and then importing the generated CSS (index.css) manually into my dist/index.js file. That way, the Tailwind classes including the ones from the theme.extend section—get picked up and included in the consuming app. // In your dist/index.js (or the entry point of the dist build) |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Description and use:
Instance of a typescript react tailwind UI lib that will packaged up and consumed in other react apps via npm package.
Expected:
On build all tailwind classes used throughout the ui lib in components INCLUDING those declared within the
extend
section oftailwind.config.ts
should be included in the build js file.Happening:
None of the classes declared within the
extend
section of thetailwding.config.ts
file are included within the dist dir.So with the example code below the colors
primary
andsecondary
are not included in the dist folder js file.For example: the tailwind class
text-primary
(which is declared within theextend
) wants to be available to the app that consumes the UI lib but it is not.Interestingly the custom
card.css
which is used in one of the components and which calls on theprimary
color works fine and the styles ofcard.css
are included within thedist
dir. And the tailwind classtext-primary
works within the UI lib on components. It;s just not included within the final build.Beta Was this translation helpful? Give feedback.
All reactions