Skip to content

Unclosed comment for an unquoted url() with /* directly after a comma #2194

Closed

Description

@RobinMalfait

PostCSS throws on valid CSS when an unquoted url() that contains /* comes directly after a ,:

const postcss = require('postcss')

postcss.parse('a{background:url(a.png), url(/b/*.png)}') // works
postcss.parse('a{background:url(a.png),url(/b/*.png)}') // CssSyntaxError: Unclosed comment

In CSS Syntax 3, the , is a comma token of its own, and url(/b/*.png) is one url token, so the /* is not a comment.

We hit this in Tailwind CSS. @tailwindcss/postcss minifies its output with Lightning CSS, then parses the result with postcss.parse(). Lightning CSS removes the space after the comma, and also the quotes of url("/b/*.png"). So a build that parsed background-image: url(a.png), url("/b/*.png") fine throws after minification. We found it while reviewing a Tailwind CSS change, not from a user report.

The tokenizer reads ,url as one word, because RE_WORD_END does not stop at ,. So the url check in the OPEN_PARENTHESES case does not match. It looks like the same kind of bug as #2185. A check of only the part of prev after its last , fixes it locally. I can send a PR with a test if you want one.

Sent by an AI assistant on behalf of @RobinMalfait.

Activity

  1. ai commented on Nov 12, 2026

    @ai
    Member

    We have a PR, I am reviewing it

  2. ai commented on Nov 13, 2026

    @ai
    Member

    The fix was release 8.5.33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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