Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style collision #2

Open
jhgeluk opened this issue May 2, 2024 · 2 comments
Open

Style collision #2

jhgeluk opened this issue May 2, 2024 · 2 comments

Comments

@jhgeluk
Copy link

jhgeluk commented May 2, 2024

Hello,

Almost everything works as expected, I'm importing the component library style.css like this:
import '@wrij/react-component-library/dist/style.css';

But the problem occurs when I'm using the component library, in a project that also uses tailwind.
When I do that, the styles from the component library collide with the styles from the project.

Do you know how this can be fixed? Can we "compile" the tailwind css in the "host" project?

@serifcolakel
Copy link
Owner

Hmm i

Hello,

Almost everything works as expected, I'm importing the component library style.css like this: import '@wrij/react-component-library/dist/style.css';

But the problem occurs when I'm using the component library, in a project that also uses tailwind. When I do that, the styles from the component library collide with the styles from the project.

Do you know how this can be fixed? Can we "compile" the tailwind css in the "host" project?

Thanks for your feedback @jhgeluk, actually I prefer tailwind css in general. I can suggest something like this to solve this. After importing the project's tailwind style file, you can import the component library style file you created. For example:

// Your App.js file or project bootstrap file.
// import your base global tailwind style
import 'assets/global.style.css'

// After you can import your package style from dist
import '@wrij/react-component-library/dist/style.css';

I think it will actually work like CSS, the last styles given will override the previous base styles.

i hope this solve your issue.

@jhgeluk
Copy link
Author

jhgeluk commented May 3, 2024

Thanks for your response, I'm currently doing it like that. But the problem occurs when I have a component from my component library with, for the example: ".hidden" class.

And when I want to show a component by adding the "md:block" class to that component, it will not work. Because it collides with the ".hidden" from the tailwind component library.

Do you know a way to work around this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants