Skip to content

v4: Automatic content detection in monorepos only finds direct package #13136

@adrhumphreys

Description

@adrhumphreys

What version of Tailwind CSS are you using?
4.0.0-alpha.6

What build tool (or framework if it abstracts the build tool) are you using?
"next": "^14.1.1"
"@tailwindcss/postcss": "^4.0.0-alpha.6",
"postcss": "^8.4.35",

What version of Node.js are you using?
v18.18.2

What browser are you using?
N/A

What operating system are you using?
macOS

Reproduction URL
Attempting to do this inside an existing project, feel free to request a reproduction if you feel it will help and I'll make one (just takes a good chunk of time so wanted to check this level of detail was required first).

Describe your issue
I'm using tailwind in a mono repo, there is a basic design system which is just a bunch of components with tailwind classes and some config for styles (e.g. bg-primary). Upgrading to v4 was seamless for this, we were able to build and publish the design system.

When using the design system in the monorepo in a Next.js project we're transpiling the components (rather than using the built version).

I noticed that the styles were not being generated, I assumed this was because the automatic detection was not picking it up. Looking at the config code, it seems like we should be passing through the base as the config variable based on the config:

type PluginOptions = {
  // The base directory to scan for class candidates.
  base?: string
}

At first I tried putting in "../.." so that it would map to a relative root directory, but it seems like the only way to use base is with an absolute path eg `"/Users/me/Code/monorepo/" which does work.

It would just be nice to be able to use a relative directory here so that when we look at deploying/cloning the repo it's not hard coded to a user directory.

I imagine this might be solved when:

We’ll introduce a way to configure content paths explicitly in the future for sure, but we’re curious to see how well this automatic approach works for everyone — it’s working awesome in our own projects.

So feel free to also close this and I can be patient 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions