Tailwind v4 + pnpm + turbo
I have a monorepo using tailwind v4, pnpm and turbo repo.
Currently I have split my webprojects into a folder called
domains
and all my shared elements inside packages
.
Since v4 uses a css file, I have a package called styling
that exports a app.css file with all my themeing and vars which I can then consume in all of my start
domains by using the following piece of code.
This works great and my theme is easily shared and I can consume the variables inside the domains.
The Bad
I have additionally created 4 separate UI packages named form
components
charts
typography
Each one of these bundles should also consume the styling from the monorepo app.css file. My initial thought was that the components exported from each of these packages would be able to correctly consume the classes once they are imported into the domains. This is not the case.
My second attempt is to import the app.css file in each of the components however this too does not work.2 Replies
extended-yellow•6mo ago
I'm try to understand the context... so: the other packages you are consuming in your main repository are not receiving the tailwind classes, is it?
Did you config a postcss.config (for each package) and install correct dependencies?
adverse-sapphireOP•6mo ago
I have figured it out
Inside my start project I was initially linking my app.css right from the package itself.
The correct way was to create a new styles.css inside each app (domain) and then add all the packages and then add that styles.css to tanstack start
so for example if this is the folder structure
Then inside website I need a styles.css file with the following