Yanick Rochon
Yanick Rochon

Reputation: 53536

How to create a component library on top of Tailwind with Turborepo?

I am trying to start a probject using Turborepo where many apps will use the same components. By default, Turorepo sets a packages/ui project for that, but I'd like to use Tailwind.css for this component library.

What should be a good setup for that library? Would Tailwind.css be required for all apps projects, or could the library self handle generating the CSS, which would be imported by all apps?

In short, are there template Turborepo projects with that configuration :

./apps
  ./app1          importing ui/styles.css (no Tailwind dep)
  ./app2          importing ui/styles.css (no Tailwind dep)
./packages
  ./ui            self-generating styles.css (Tailwind dep)

Upvotes: 6

Views: 6763

Answers (1)

mitchazj
mitchazj

Reputation: 566

I'd check the examples folder on their GitHub, for example:

are both probably useful for what you want here. A combination of the configurations from each of their examples above should provide what you're looking for.

Upvotes: 9

Related Questions