Skip to content

CSS: Nested rules lead to invalid output in production mode #10203

@SirPepe

Description

@SirPepe

🐛 bug report

Parcel outputs invalid CSS in production mode when a declaration with a var() (and possibly other function values) appears between two nested rules. Example:

div {
  table {
    color: lime;
  }
  color: var(--whatever);
  span {
    color: red;
  }
}

Result:

div{& table{color:#0f0}color:var(--whatever)& span{color:red}}

The semicolon after var(--whatever) gets removed, turning the entire rule invalid. This does not happen in dev mode.

🎛 Configuration (.babelrc, package.json, cli command)

Vanilla Parcel in production mode without any configuaration.

🤔 Expected Behavior

The minifier should not murder basic CSS.

😯 Current Behavior

The minifier murders basic CSS.

💁 Possible Solution

Keep the semicolon I guess 🙃

💻 Code Sample

https://github.com/SirPepe/temp-parcel-css-minifier

🌍 Your Environment

Software Version(s)
Parcel 2.15.4
Node 23.7.0
npm/Yarn NPM @ 10.9.2
Operating System Ubuntu Linux, 6.8.0-64-generic

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