ericcornelissen/webmangler

Some comments prevent mangling CSS values

Closed this issue · 0 comments

Bug report

packages/core v0.1.23

Description

The built-in CSS language plugin will not mangle CSS values if there is a comment with either } or ; inside the CSS ruleset before the value to be mangled.

Reproduce

Bug 1

  1. Have the following CSS:

    .foobar {
      background-color: var(--color);
      color/*}*/: var(--color);
    }
  2. Run WebMangler core v0.1.23 on this CSS with the CSS Language plugin enabled as well as the CSS variable mangler with the pattern [a-z]+.

  3. Observe the mangled CSS is:

    .foobar {
      background-color: var(--a);
      color/*}*/: var(--color);
    }

Bug 2

  1. Have the following CSS:

    .foobar {
      background-color: var(--color);
      color: /*;*/ var(--color);
    }
  2. Run WebMangler core v0.1.23 on this CSS with the CSS Language plugin enabled as well as the CSS variable mangler with the pattern [a-z]+.

  3. Observe the mangled CSS is:

    .foobar {
      background-color: var(--a);
      color: /*;*/ var(--color);
    }