Skip to content

[v4] Background gradient does not display (generated css has syntax error) #16037

Closed
@oliverlambson

Description

@oliverlambson

What version of Tailwind CSS are you using?

v4.0.1

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

postcss-cli 11.0.0, postcss 8.5.1

What version of Node.js are you using?

v22.12.0

What browser are you using?

Chrome & Safari (same issue)

What operating system are you using?

macOS

Reproduction URL

https://github.com/oliverlambson/tailwind-gradient

Describe your issue

When using background gradients, the generated css contains a syntax error that causes the gradient to not display.

Actual output (css formatted for clarity):

  .to-green-500 {
    --tw-gradient-to: var(--color-green-500);
    --tw-gradient-stops: var(
      --tw-gradient-via-stops,
      var(--tw-gradient-position,) /* there should be a comma after closing paren */
      var(--tw-gradient-from) var(--tw-gradient-from-position),
      var(--tw-gradient-to) var(--tw-gradient-to-position)
    );
  }

Correct output:

  .to-green-500 {
    --tw-gradient-to: var(--color-green-500);
    --tw-gradient-stops: var(
      --tw-gradient-via-stops,
      var(--tw-gradient-position),
      var(--tw-gradient-from) var(--tw-gradient-from-position),
      var(--tw-gradient-to) var(--tw-gradient-to-position)
    );
  }
As-generated css Manually-corrected css
Image Image

Metadata

Metadata

Assignees

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