Styles not being applied on components imported from an external package #6056
-
Given the following code:
The styles set on the On the other hand, the styles set on the Would someone be so kind to help me with this issue, please? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 11 replies
-
Hey! Thank you for your question! I'm assuming that you are using This means that you have to do that for every project you are using that library in. More info: https://tailwindcss.com/docs/configuration#presets |
Beta Was this translation helpful? Give feedback.
-
@RobinMalfait, I'm so grateful! Including the path on the I'll check what @jquense mentioned later, but since that involves modifying the package and testing it I think I'm going to delay it just for now. Thank you very much for the help! |
Beta Was this translation helpful? Give feedback.
-
I raised this as a good improvement here a bit ago: #5208 |
Beta Was this translation helpful? Give feedback.
-
hello, is this still the best option we have to purge components imported from a library? thanks! |
Beta Was this translation helpful? Give feedback.
-
If you're working with JIT its helpful to know that the "purge" option has been renamed to "content". |
Beta Was this translation helpful? Give feedback.
-
@RobinMalfait how can we consume an NPM package that has tailwind in an app that does not have tailwind? |
Beta Was this translation helpful? Give feedback.
-
how it can be done today? |
Beta Was this translation helpful? Give feedback.
Hey! Thank you for your question!
Much appreciated! 🙏
I'm assuming that you are using
JIT
mode here (otherwise everything was generated for you – unless you purged).However, JIT mode works by scanning your source files for Tailwind classes. This means that inside your
purge
paths you have to include the paths to your components form your library../node_modules/react-component-library/**/*.js
for example.This means that you have to do that for every project you are using that library in.
Alternatively, you can also create a
tailwind.config.js
file inside your package that already contains the correct paths. If you have that, than you can use thepresets
features and include that config …