First i thought that the problem was Home Assistant not loading the CSS, but now i’m injecting the CSS into the final JS with Vite. It is working, but not on Home Assistant.
I got it working! I’m not the best candidate for explaining but it’s something related to the incompatibility of the way TailwindCSS works with Web Components.
If i understood correctly, TailwindCSS styles are inserted on <head>, where web components with shadow root cannot inherit from.
To solve it, i used a package called Twind, which, among many other cool features, allow me to translate the TailwindCSS classes to the real CSS and put the result manually inside the component’s shadow root. And it works!!!
That’s true! With TailwindCSS, developing pretty custom card becomes soooo much easier
I hope more people gets to find this and start using TailwindCSS as i’m doing now
Exciting news! I developed “TailwindCSS Template Card”, which you can use to experiment TailwindCSS with Home Assistant and build pretty cards with instant rendering while editing!