Skip to content

@reference misses some fallback values #17761

@aaronadamsCA

Description

@aaronadamsCA

What version of Tailwind CSS are you using?

v4.1.4

What build tool (or framework if it abstracts the build tool) are you using?

N/A

What version of Node.js are you using?

v23.11.0

What browser are you using?

N/A

What operating system are you using?

N/A

Reproduction URL

https://play.tailwindcss.com/lAycX1oWGq?file=css

Describe your issue

We apply Tailwind preflight CSS to the entire page, then use @reference to generate utility CSS per module. Unfortunately there are currently a few gaps in the generated CSS. It looks like #16774 misses some fallback values.

I can reproduce the issue on Tailwind Play using this simple config:

@import "tailwindcss/preflight.css";
@reference "tailwindcss/theme.css";
@tailwind utilities;

Right away you'll notice the default HTML has some broken styles because --color-gray-950 doesn't have a fallback value:

https://play.tailwindcss.com/lAycX1oWGq?file=css

Image

Here's another example where --breakpoint-sm doesn't have a fallback value:

https://play.tailwindcss.com/bbX2smHCx6?layout=horizontal

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions