-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
CSS sign()
and abs()
support?
#1449
Comments
Hi @unit-404, We already support So it would be relatively straightforward to create a plugin for this. If you have time, please consider contributing : https://github.com/csstools/postcss-plugins/blob/main/CONTRIBUTING.md#creating-a-new-plugin-here The name for this plugin should be |
This has shipped in Thank you again for requesting this |
Solutions for fallback with custom properties (I didn't reinterpret to CSS)... /* solution for dynamic custom properties */
/* I didn't include `@supports` feature here. */
// added
$cps: 0.00001;
// any type (abs only)
@function abs($a) {
@return string.unquote("max(#{$a}, calc(-1 * #{$a}))");
}
// if number type
@function sign($a) {
@return string.unquote("round(to-zero, clamp(-1, calc(#{$a} / max(#{abs($a)}, #{$cps})), 1), 1)");
}
// if length such as px
@function sign-unit($a, $unit: "px") {
@return string.unquote("round(to-zero, clamp(-1#{$unit}, calc(#{$a} / max(tan(tan2(#{abs($a)}, 1#{$unit})), #{$cps})), 1#{$unit}), 1#{$unit})");
}
|
As before, PR's are welcome If you have time, please consider contributing : https://github.com/csstools/postcss-plugins/blob/main/CONTRIBUTING.md |
What would you want to propose?
I want to ask support for CSS
sign()
andabs()
.Suggested solution
Additional context
About spec and chrome support:
Validations
Would you like to open a PR for this feature?
The text was updated successfully, but these errors were encountered: