New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@juristr/nx-tailwind-sync

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@juristr/nx-tailwind-sync

Nx [sync generator](https://nx.dev/docs/concepts/sync-generators) that auto-manages `@source` directives in CSS files for Tailwind v4 monorepos.

latest
Source
npmnpm
Version
0.0.9
Version published
Maintainers
1
Created
Source

Nx Tailwind Sync

Nx sync generator that auto-manages @source directives in CSS files for Tailwind v4 monorepos.

Problem

Tailwind v4 requires to define @source directives for dependencies that might be outside its own project configuration. Something that is common in monorepos. Manually maintaining these in a monorepo is error-prone. See this blog post for more background.

Solution

This plugin traverses the Nx project graph and generates @source directives for all transitive dependencies.

Detection

A project is detected as using Tailwind v4 if:

  • Has a CSS file with @import 'tailwindcss'
  • Has a Vite config using tailwindcss() from @tailwindcss/vite

CSS File Search Paths

Default locations checked:

  • src/styles.css
  • .storybook/styles.css

Additional paths can be configured via the additionalStylePaths option.

Output

The generator inserts/updates a managed block in CSS files:

@import 'tailwindcss';

/* nx-tailwind-sources:start */
@source "../../../packages/shared/daypulse-ui";
@source "../../../packages/daypulse/styles";
/* nx-tailwind-sources:end */

Usage

Register the sync generator on tasks that need it (e.g., build, dev):

{
  "nx": {
    "targets": {
      "build": {
        "syncGenerators": ["@juristr/nx-tailwind-sync:source-directives"]
      }
    }
  }
}

Run manually:

pnpm nx sync

Options

OptionTypeDescription
additionalStylePathsstring[]Extra relative paths to search for styles.css

Building

nx build @juristr/nx-tailwind-sync

FAQs

Package last updated on 10 Feb 2026

Related posts