Skip to content

[css]: custom property with comment breaks #15948

@emilbader

Description

@emilbader

Prettier 3.2.3
Playground link

--parser css

Input:

h1 {
  --background: blue;
  --ON: initial /* ON */;
  --OFF: /* OFF */;
  --custom-prop: var(--OFF)
}

Output:

h1 {
  --background: blue;
  --ON: initial /* ON */;
  --OFF:  /* OFF *;
  --custom-prop: var(--OFF);
}

Expected output:

h1 {
  --background: blue;
  --ON: initial /* ON */;
  --OFF: /* OFF */;
  --custom-prop: var(--OFF);
}

Why?
In this case, the custom property without a value is indented to a point where the ending slash (of the --OFF property comment) gets removed and opens up the comment, essentially commenting out the following code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue!lang:css/scss/lessIssues affecting CSS, Less or SCSSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions