Skip to content

Keyframe including invalid code is removed while browsers ignore the invalid code part #1103

@sapphi-red

Description

@sapphi-red
@keyframes gradient-success-in {
  0% {
    --tw-gradient-from: color-mix(
      in oklab,
      oklch(59.6% 0.145 163.225) 0%,
      transparent
    );
    @supports (color: color-mix(in lab, red, red)) {
      --tw-gradient-from: color-mix(
      in oklab,
      var(--color-emerald-600) 0%,
      transparent
    );
    }
  }
  100% {
    --tw-gradient-from: color-mix(
      in oklab,
      oklch(59.6% 0.145 163.225) 20%,
      transparent
    );
    @supports (color: color-mix(in lab, red, red)) {
      --tw-gradient-from: color-mix(
      in oklab,
      var(--color-emerald-600) 20%,
      transparent
    );
    }
  }
}

is transformed to

@keyframes gradient-success-in {}

.
While the input is invalid, I expect lightningcss to output:

@keyframes gradient-success-in {
  0% {
    --tw-gradient-from: color-mix(
      in oklab,
      oklch(59.6% 0.145 163.225) 0%,
      transparent
    );
  }
  100% {
    --tw-gradient-from: color-mix(
      in oklab,
      oklch(59.6% 0.145 163.225) 20%,
      transparent
    );
  }
}

because browsers (tested with Chrome) treats the input like that. Also it would be nice to have a warning.

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