DEV Community

Discussion on: Using tailwind at run-time with web components

Collapse
 
43081j profile image
James Garbutt

I think both paths are as valid as each other. I'd personally prefer a build-time solution as I have a very static set of styles I use, so if i know about them at build-time i may as well do the heavy lifting there. There are use cases where you want to dynamically generate/use these styles though, in which case a run time solution is nicer.

Your solution is interesting, pretty much is where i ended up when trying to throw together one using existing tooling. I also made a rollup plugin which replaces css templates inline with their processed equivalents and strips unused css at the same time. Both seem to be the way to go if wanting this at build time.

I think the ultimate build-time solution would be that CSS modules land in browsers, so we can just process a regular css file and import it natively into our modules.