Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discardOverridden does not work #663

Open
jihb opened this issue Dec 10, 2018 · 8 comments
Open

discardOverridden does not work #663

jihb opened this issue Dec 10, 2018 · 8 comments
Labels
Milestone

Comments

@jihb
Copy link

jihb commented Dec 10, 2018

Suppose there is the following css code:

.selector {
  margin-top: 3px;
  margin-top: 5px\0;
}

After being Compiled with cssnano, the output is:

.selector {
  margin-top: 5px\0;
}

the top one will be discard~

so I try to set 'preset' property like this:

require('cssnano')({
  preset: [
   'default', {
     discardOverridden: false
   }
  ]
})

but it does not work , so how can I solve this problem?

@alexander-akait
Copy link
Member

bug, need fix, feel free to send a PR

@jihb
Copy link
Author

jihb commented Dec 11, 2018

When I disabled the option 'mergeLonghand' , the bug was disappear~

so it is a bug of 'postcss-merge-longhand'~

@alexander-akait
Copy link
Member

@jihb yep, feel free to send a PR with fix

@stegano
Copy link

stegano commented Nov 4, 2019

Is this an issue resolved?

@ludofischer ludofischer modified the milestones: 4.1, backlog Mar 9, 2021
@Akiyamka
Copy link

Look like discardOverridden now broken
image

@ludofischer
Copy link
Collaborator

The issue is stranger than I thought, it looks like discard-overridden is correctly excluded from the plugin list if you set discardOverriden: false, so it might not be it that's causing the folding.

@ludofischer
Copy link
Collaborator

Look like discardOverridden now broken

As far I know, it was never meant to work across rules, only for declarations inside the same rule.

@fvsadem
Copy link

fvsadem commented Sep 22, 2023

This optimisation doesn't work at all...

image

@ludofischer ludofischer modified the milestones: 6.0.0, backlog Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants