Repository navigation
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. |
Replies: 4 comments 15 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}',
],
},
// ...
} |
|
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? |
|
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
|
|
Hey, is there a recommended way by now or do I still have to refer to my node_modules folder? Thank you. |
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}', ], }, // ... }