I am building a widget on React with CRA and parcel to bundle, which can be added to other websites via a small JS script in index HTML. Used CSS modules for styling the components. I try adding this widget to a WordPress website, the CSS from WP pages override the CSS styles of the components.
I could think about two solutions to retain my styles:
- Inline styles to all components
- Adding !important to all CSS properties in CSS classes (recommended to be used sparingly)
Will there be a performance hit due to increase in page size due to inline styles Also worried about not being able to use pseudo elements or media queries if I go with inline styles
I hope there some way to achieve this, some packages in react will helpful.