Wildhoney / ReactShadow

:beginner: Utilise Shadow DOM in React with all the benefits of style encapsulation.
https://react-shadow.herokuapp.com/
MIT License
1.29k stars 80 forks source link

Is there any chance to have a working example with CRA and TS? #119

Open xumix opened 3 years ago

xumix commented 3 years ago

I'm struggling with implementing a widget based on create react app, particularly, I'm unable to add my global styles to the shadow root since style-loader injects them into head Could you please give some direction how to fix this? Maybe it is possible to attach to an pre-existing shadowRoot?

I've tried

import style from "./css/site.css";

<style type="text/css">{style.toString()}</style>

but this gives me <style type="text/css">[object Module]</style>

GisonL commented 7 months ago

use inline loader to import pure string styles from css import tailwindCSS from "@/styles/tailwind.less?inline"; and then <style type="text/css">{tailwindCSS}</style>