Skip to content

CSS minificator incorrectly removes property with !important value. #1372

@SevInf

Description

@SevInf

When CSS rule declares the same property twice, earlier declaration with !important modifier and later one without it, CSS minified incorrectly keeps the later one.

Steps to reproduce:

  1. Create style.css with following content:
.selector {
  padding: 10px !important;
  padding: 0;
}
  1. Run esbuild --minify style.css

Expected output:

.selector{padding:10px!important}

Actual output:

.selector{padding:0}

I acknowledge that original thing is a pretty silly code to write and should probably be caught by a linter. Nevertheless, this introduces a difference between minified and non-minified code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions