swc icon indicating copy to clipboard operation
swc copied to clipboard

[CSS] Deduplication of minifier is not smart enough

Open hyf0 opened this issue 2 years ago • 2 comments

Describe the feature

For input

body {
  color: red;
}

body {
  color: red;
}

cssnano will discard duplicated rules.

https://cssnano.co/playground/

image

Babel plugin or link to the feature description

No response

Additional context

Not an urgent request. Just want to bring it up.

hyf0 avatar Jul 18 '23 07:07 hyf0

It's already supported by the swc_css_minifier

kdy1 avatar Jul 19 '23 02:07 kdy1

@kdy1 I tested locally.

A complicated case like this isn't discarded.

body {
  color: red;
}

h1 {
  color: red;
}

body {
  color: red;
}

CSSnano outout image

hyf0 avatar Jul 19 '23 06:07 hyf0