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

Process all declarations when preserve: false #1555

Conversation

depoulo
Copy link

@depoulo depoulo commented Jan 23, 2025

When { preserve: false } is used, there's no use case for disabling this plugin for a single ruleset by providing a manual fallback. This change should not make a difference for almost anyone, except for those who mistakenly (e.g. through preprocessors) declared any duplicate color declarations. Before this change, this plugin would effectively skip any ruleset with duplicate color declarations when { preserve: false } was used.

When `{ preserve: false }` is used, there's no use case for disabling
this plugin for a single ruleset by providing a manual fallback. This
change should not make a difference for almost anyone, except for those
who mistakenly (e.g. through preprocessors) declared any duplicate color
declarations. Before this change, this plugin would effectively skip any
ruleset with duplicate color declarations when `{ preserve: false }` was used.
Comment on lines +104 to +107
.manual-fallback {
color: white;
color: rgb(255, 255, 255);
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the change to index.ts, this would read

.manual-fallback {
	color: white;
	color: contrast-color(darkgreen max);
}

which would be quite an unexpected result, as it effectively skips processing.

@romainmenke
Copy link
Member

Hi @depoulo

Thank you for taking the time to open a pull request.
Unfortunately I am not going to apply this change.
The current behavior is intentional and correct.

When a user adds their own fallback or when there is a relevant @support rule we see this as a signal that the user does not want this plugin to transform their CSS.
Especially when preserve: false is this important.

Feel free to open an issue if you want to make a case for this change :)

@depoulo
Copy link
Author

depoulo commented Jan 23, 2025

Oooh so your use case is to implicitly opt out of { preserve: false } for a single rule by providing a manual fallback! Might make sense to extend the examples accordingly. In any case, nevermind, and thank you for the plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants