Skip to content

Feature request: Add option in plugin-tailwind to control @import "tailwindcss"; #543

@Hashversion

Description

@Hashversion

Summary

Currently, @terrazzo/plugin-tailwind outputs a theme file that always includes @import "tailwindcss"; at the top. In some setups (monorepos, shared tokens packages, or when consumers already import Tailwind globally), this creates duplication or unwanted imports.

It would be useful to make this behavior configurable in the plugin, so projects can decide whether or not to include the @import "tailwindcss"; line.

Proposal & prior art

  1. Syntax

Add a new plugin option in terrazzo.config.js when configuring the Tailwind plugin. For example:

tailwind({
  filename: "tailwind-theme.css",
  includeTailwindImport: true // default
})

true → output file includes @import "tailwindcss"; (current behavior)
false → omit the import (useful if Tailwind is already imported elsewhere)

  1. Alternatives

Option A (recommended): Boolean flag (includeTailwindImport), simple, minimal change.
Option B: Always omit the import, breaking change for existing users who expect it.

  1. Breaking change?

If we default to true, this is not breaking (preserves current behavior).
Only users who want to suppress the import would opt into the new flag.

  1. Prior art

Tools like Style Dictionary allow flexible control of output templates.
PostCSS/Tailwind setups often separate concerns: apps import Tailwind globally, while design tokens packages only provide variables.

  1. Expected output

Current output (always):

@import "tailwindcss";

@theme {
  --color-primary: #3b82f6;
}

With includeTailwindImport: false:

@theme {
  --color-primary: #3b82f6;
}

Extra

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions