DEV Community

Krzysztof Żuraw
Krzysztof Żuraw

Posted on • Originally published at krzysztofzuraw.com on

12 3

Compiling Tailwind CSS components in monorepo

If you have monorepo with Tailwind CSS components in one package and application in the other you may find that Tailwind won't work for components. To fix that you need to add new entry to content inside tailwind.config.js:

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
    "../../packages/ui/**/*.{js,ts,jsx,tsx}", // here is path to Tailwind CSS components package
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};
Enter fullscreen mode Exit fullscreen mode

Top comments (4)

Collapse
 
jtlapp profile image
Joe Lapp

Saved my butt. Thank you!

Collapse
 
cesconix profile image
Francesco Pasqua

Thank you!

Collapse
 
jhortale profile image
Joao Hortale • Edited

I fixed with this glob "**/src/**/*.{js,ts,jsx,tsx}" an placed this config file on a tailwind package that can be shared with all the packages and apps that follow this path.

Collapse
 
amr3k profile image
Amr

Thanks so much. I spent some time searching, using chatGPT, gemeni with no help, but I found this article from Google search and the solution you provided works very well.

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay