Skip to content

[v4] upgrade does not work for dark mode variant with media query #16171

@fiws

Description

@fiws

What version of Tailwind CSS are you using?

v4.0.3

What version of Node.js are you using?

v23.7.0

What operating system are you using?

Arch Linux

Reproduction URL

https://github.com/fiws/tailwind-issue-f1

Describe your issue

After running npx @tailwindcss/upgrade@next, my "dark" theme config in the old tailwind.config.js was transformed into @custom-variant dark (@media not print { .dark & }); this does not work and appears to be invalid syntax. See below for details:

before

https://github.com/fiws/tailwind-issue-f1/blob/676604340b5ad3ef2384ea86ab79d755a82dfb40/tailwind.config.js#L7

// tailwind.config.js
darkMode: ["variant", "@media not print { .dark & }"],

Image

after

https://github.com/fiws/tailwind-issue-f1/blob/main/src/index.css#L3

@custom-variant dark (@media not print { .dark & });

Image

Image


I also have no idea what to correct syntax is..

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