lightningcss icon indicating copy to clipboard operation
lightningcss copied to clipboard

Missing semicolon after variable defined between selectors

Open gejgalis opened this issue 7 months ago • 3 comments

When --some-var is placed between selectors, then minifier omits the semicolon.

Image

.Foo {
  color: red;

  .Bar {
    color: blue;
  }

  --some-var: 100%;  /* <- this semicolon is missing */

  .Baz {
    color: green;
  }
}

Playground

gejgalis avatar Jun 09 '25 07:06 gejgalis

This is still an issue

StratusFearMe21 avatar Jul 14 '25 22:07 StratusFearMe21

This problem also seems to be with nested statements omitting semi-colons, not specifically with variables

StratusFearMe21 avatar Jul 15 '25 00:07 StratusFearMe21

I just ran into the same issue. Playground

p {
  & * {
    margin: 0;
  }
  margin: 1em;
  & :is(a) {
    width: 2em;
  }
}

Output:

p{& *{margin:0}margin:1em& :is(a){width:2em}}

The semicolon was missing before the second &.

yihui avatar Nov 14 '25 02:11 yihui