How can i keep npm packages with tailwind.css working #8814
-
I creat a privite npm package(PackageA) with tailwind. There are some media query classes like
I use After I build ProjectB, I find
I Try to add 'PackageA/dist/style.css' in
Is there anyway to solve this problem. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 13 replies
-
I have found the solution👇 my tailwind.config.js look likes below: module.exports = {
purge: {
enable: process.env.NODE_ENV !== 'development',
content: [
'./src/**/*.html',
'./src/**/*.vue',
+ './node_modules/my-component-path/**/*.{vue,js,ts,jsx,tsx}',
],
},
// ...
} |
Beta Was this translation helpful? Give feedback.
-
Having to map my explicit node_modules path seems a bit awkward. Is there a way to use the existing path resolution features that we use with other packages?
|
Beta Was this translation helpful? Give feedback.
-
It looks like the issue you're encountering is due to conflicting Tailwind CSS classes between your private npm package (PackageA) and your ProjectB setup. When importing PackageA into ProjectB, the styles from PackageA's Here are two possible solutions to address this problem: Solution 1: Use Tailwind's
|
Beta Was this translation helpful? Give feedback.
-
Hey, is there a recommended way by now or do I still have to refer to my node_modules folder? Thank you. |
Beta Was this translation helpful? Give feedback.
I have found the solution👇
#4389
my tailwind.config.js look likes below:
module.exports = { purge: { enable: process.env.NODE_ENV !== 'development', content: [ './src/**/*.html', './src/**/*.vue', + './node_modules/my-component-path/**/*.{vue,js,ts,jsx,tsx}', ], }, // ... }