Configure Tailwind 4 with Vite in an NPM workspace monorepo

Author profile pic
Juri Strumpflohner
Published

Learn how to efficiently configure Tailwind CSS 4 with Vite in an NPM workspace monorepo! This tutorial covers the simplified Tailwind 4 installation, working with modularized packages, and most importantly - how to automate glob pattern management using Nx sync generators so you never have to manually maintain source directives again.

🔧 What you’ll learn:

  • Setting up Tailwind 4 with Vite plugin in NPM workspaces
  • Handling styles across multiple packages in a monorepo
  • Using source directives to include sub-packages
  • Automating configuration with Nx sync generators
  • Keeping your workspace in sync as dependencies change

💡 Perfect for teams working with monorepos who want to streamline their Tailwind setup and avoid manual configuration maintenance.

== Chapters ==

  • 0:00 Introduction and video overview
  • 0:25 Tailwind 4 simplified installation overview
  • 1:17 Tailwind 4 configuration setup in the demo workspace
  • 2:23 Common issues with NPM workspaces
  • 3:03 Understanding modularized package structure
  • 4:13 Using source directives for sub-packages
  • 4:54 Fixing styles with proper configuration
  • 5:05 The manual maintenance problem
  • 6:08 Automating with Nx sync generators
  • 7:08 Creating the Tailwind sync plugin
  • 8:48 Registering sync generators in package.json
  • 10:06 Demo: Automatic glob pattern generation
  • 11:21 Manual sync trigger with nx sync
  • 11:40 Wrap-up and final thoughts