Open berkerdemirer opened 1 month ago
I had to add that classname to the wrapper div in one of my jsx.
Actually, it did not work as expected.. reopening for a discussion
hi @berkerdemirer ! Did you get TailwindCSS working without a plugin? I guess you're missing the content: ['**/*.html'],
param in your config. In this case the CSS is also empty (can't find the tailwind classes)
another thing - Tailwind is HTML processor that is crawling your HTML files (kind of) - it generates only CSS used in your HTML. Probably since our preflight styles are customized (need that extra selector) they are filtered out if not found in HTML. I don't see it in your HTML. If you use it - you will see the CSS in there
another suggestion - if you ship tailwind-styles components - you just make tailwind a peer dependency (host app should have its own config with its own opinion/policy about the preflight styles), + some partial config for the host to extend with (if any custom theme stuff needed, like own colors/animations etc). So I wouldn't use this plugin on the library side at all
Hi, Roman,
The thing is, once I ship this package, it should be framework and setup-agnostic. It has to work when there is no tailwind configured in the target app. That's why I am compiling the CSS to import it later when I use this package.
Regarding adding HTML to the content array, you were right that I was missing it. But where exactly I should add the wrapper class inside the HTML? To body tag or?
Hi! You can put your wrapper anywhere up your DOM tree - body is fine I guess. You may put a requirement to add your specified class to your library consumer DOM root. But to have that complete CSS compiled you need that build-time HTML page with all your components
@berkerdemirer please check my suggestions. What do you think?
Hey,
I am trying to ship a library and I don't want my library's preflight to clash with consumer app's styles. That's why I wanted to isolate everything.
I added the tw config as referenced in the doc:
index.html:
But when I compile my CSS, I only see the comments for the preflight classes. Classes themselves are missing. Is there something else that I should be doing?