-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
bug - postcss-minify-gradients #386
Comments
the latest param of -webkit-radial-gradient is set to 0 since 25%, how can i do in my code to avoid this error? |
You can set |
Would it be possible to see the CSS output after it has been compiled through your preprocessor (but before cssnano)? |
@ben-eb Of course. Here is the output compiled through my preprocessor without cssnano @-webkit-keyframes flash-anim {
0% {
background: -webkit-radial-gradient(50% -10%,circle,#fff,rgba(255,255,255,0) 0);
}
5% {
background: -webkit-radial-gradient(50% -4%,circle,#fff,rgba(255,255,255,0) 4%);
}
10% {
background: -webkit-radial-gradient(50% 2%,circle,#fff,rgba(255,255,255,0) 8%);
}
15% {
background: -webkit-radial-gradient(50% 8%,circle,#fff,rgba(255,255,255,0) 12%);
}
20% {
background: -webkit-radial-gradient(50% 14%,circle,#fff,rgba(255,255,255,0) 16%);
}
25% {
background: -webkit-radial-gradient(50% 20%,circle,#fff,rgba(255,255,255,0) 20%);
}
30% {
background: -webkit-radial-gradient(50% 26%,circle,#fff,rgba(255,255,255,0) 24%);
}
35% {
background: -webkit-radial-gradient(50% 32%,circle,#fff,rgba(255,255,255,0) 28%);
}
40% {
background: -webkit-radial-gradient(50% 38%,circle,#fff,rgba(255,255,255,0) 32%);
}
45% {
background: -webkit-radial-gradient(50% 44%,circle,#fff,rgba(255,255,255,0) 36%);
}
50% {
background: -webkit-radial-gradient(50% 50%,circle,#fff,rgba(255,255,255,0) 40%);
}
55% {
background: -webkit-radial-gradient(50% 56%,circle,#fff,rgba(255,255,255,0) 36%);
}
60% {
background: -webkit-radial-gradient(50% 62%,circle,#fff,rgba(255,255,255,0) 32%);
}
65% {
background: -webkit-radial-gradient(50% 68%,circle,#fff,rgba(255,255,255,0) 28%);
}
70% {
background: -webkit-radial-gradient(50% 74%,circle,#fff,rgba(255,255,255,0) 24%);
}
75% {
background: -webkit-radial-gradient(50% 80%,circle,#fff,rgba(255,255,255,0) 20%);
}
80% {
background: -webkit-radial-gradient(50% 86%,circle,#fff,rgba(255,255,255,0) 16%);
}
85% {
background: -webkit-radial-gradient(50% 92%,circle,#fff,rgba(255,255,255,0) 12%);
}
90% {
background: -webkit-radial-gradient(50% 98%,circle,#fff,rgba(255,255,255,0) 8%);
}
95% {
background: -webkit-radial-gradient(50% 104%,circle,#fff,rgba(255,255,255,0) 4%);
}
100% {
background: -webkit-radial-gradient(50% 110%,circle,#fff,rgba(255,255,255,0) 0);
}
}
@keyframes flash-anim {
0% {
background: -webkit-radial-gradient(50% -10%,circle,#fff,rgba(255,255,255,0) 0);
}
5% {
background: -webkit-radial-gradient(50% -4%,circle,#fff,rgba(255,255,255,0) 4%);
}
10% {
background: -webkit-radial-gradient(50% 2%,circle,#fff,rgba(255,255,255,0) 8%);
}
15% {
background: -webkit-radial-gradient(50% 8%,circle,#fff,rgba(255,255,255,0) 12%);
}
20% {
background: -webkit-radial-gradient(50% 14%,circle,#fff,rgba(255,255,255,0) 16%);
}
25% {
background: -webkit-radial-gradient(50% 20%,circle,#fff,rgba(255,255,255,0) 20%);
}
30% {
background: -webkit-radial-gradient(50% 26%,circle,#fff,rgba(255,255,255,0) 24%);
}
35% {
background: -webkit-radial-gradient(50% 32%,circle,#fff,rgba(255,255,255,0) 28%);
}
40% {
background: -webkit-radial-gradient(50% 38%,circle,#fff,rgba(255,255,255,0) 32%);
}
45% {
background: -webkit-radial-gradient(50% 44%,circle,#fff,rgba(255,255,255,0) 36%);
}
50% {
background: -webkit-radial-gradient(50% 50%,circle,#fff,rgba(255,255,255,0) 40%);
}
55% {
background: -webkit-radial-gradient(50% 56%,circle,#fff,rgba(255,255,255,0) 36%);
}
60% {
background: -webkit-radial-gradient(50% 62%,circle,#fff,rgba(255,255,255,0) 32%);
}
65% {
background: -webkit-radial-gradient(50% 68%,circle,#fff,rgba(255,255,255,0) 28%);
}
70% {
background: -webkit-radial-gradient(50% 74%,circle,#fff,rgba(255,255,255,0) 24%);
}
75% {
background: -webkit-radial-gradient(50% 80%,circle,#fff,rgba(255,255,255,0) 20%);
}
80% {
background: -webkit-radial-gradient(50% 86%,circle,#fff,rgba(255,255,255,0) 16%);
}
85% {
background: -webkit-radial-gradient(50% 92%,circle,#fff,rgba(255,255,255,0) 12%);
}
90% {
background: -webkit-radial-gradient(50% 98%,circle,#fff,rgba(255,255,255,0) 8%);
}
95% {
background: -webkit-radial-gradient(50% 104%,circle,#fff,rgba(255,255,255,0) 4%);
}
100% {
background: -webkit-radial-gradient(50% 110%,circle,#fff,rgba(255,255,255,0) 0);
}
} |
@ben-eb I made a PR. Please review it ASAP. Thanks. XD |
It's possible that the original syntax has an error in it, if you have a look at the spec: https://drafts.csswg.org/css-images-3/#radial-gradient-syntax
Whereas your gradients are defined like: background: -webkit-radial-gradient(50% -10%, circle, #fff, hsla(0,0%,100%,0) 0); I think that this needs to be changed to: background: -webkit-radial-gradient(circle at 50% -10%, #fff, hsla(0,0%,100%,0) 0); In other words when supplying a |
the standard syntax defined like
no prefix But for Safari Opera Firefox compatibility it`s ok defined like
I think cssnano should enhance this code Just need to check the arg[1] is a color or not. What`s your opinion? If you agree with me, I can make a pr. |
Ah so the parameters are different from the specification? In this case I'm happy to support different logic for these cases. We could have separate block(s) for prefixed radial gradients, e.g: if (
node.value === '-webkit-radial-gradient' ||
node.value === '-webkit-repeating-linear-gradient'
) {
// custom logic
} Would you like to update your pull request with this? Edit: https://webkit.org/blog/1424/css3-gradients/ might be helpful as documentation for the old syntax. |
OK! It`s my pleasure. Tomorrow I will update my PR. Edit: I will update this PR at this weekend. |
Updated my PR. I developed a small package called is-color-stop to check if the string is a color-stop string. If you have any further questions please don’t hesitate to contact me. |
I found there is a bug during using css-nano - postcss-minify-gradients to process css
gradient
.Here is my less file.
after css-nano - postcss-minify-gradients
Please notice the diff the value greater than
25%
, the final value decreases to 0,it`s so weird.The solution now I could offer is to disable the
postcss-minify-gradients
.Setting css-loader minimize an option
postcss-minify-gradients
to false.Like
minimize: { postcss-minify-gradients: false }
The text was updated successfully, but these errors were encountered: