-
-
Notifications
You must be signed in to change notification settings - Fork 75
postcss-gradient-stop-increments #895
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
postcss-gradient-stop-increments #895
Conversation
@romainmenke This looks really good! Why do some examples of Examples:
I would presume this won't actually matter in practice if this hits core CSS, as that'll all happen under the hood and we'll only see the actual Seriously great & fast work on this! 💯🔥 |
Under the hood this uses our tokenizer. We build it specifically for dev tooling and it preserves the original input (including whitespace and comments). This is the major difference between it and something like csstree. But I also added This package can solve some So the leading |
Thanks for your effort 👍 looks very promising! I will try it and create a few demos to add it to the proposal. |
The package you created does not appear to be public on npmjs.com yet. Is this the correct link?: |
Yeah, hasn't been published yet. I first wanted to be sure that this was looking ok for @Afif13 @Antonio-Laguna this should be good to go, and doesn't require the usual in-depth review (is experimental). |
@romainmenke @Afif13 I've also got this working pretty effectively in a CodePen env for easy tinkering. Thanks for all the work on this, Romain! https://codepen.io/brandonmcconnell/pen/YzOOBVj/66c65611ba8bf3133f1cf87ccfe09c44?editors=0100 |
@romainmenke First bug-ish report! If I do For example: .gradient {
background: conic-gradient(red, blue ++40%, blue ++20%, red ++0%, green ++40%);
/* …becomes… ❌ */
background: conic-gradient(red, blue +40%, blue 60%, red 0, green 100%);
/* …instead of… ✅ */
background: conic-gradient(red, blue +40%, blue 60%, red 60%, green 100%);
} as seen in my CodePen example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great work!
I did notice what @brandonmcconnell points here w3c/csswg-drafts#8616 (comment) about --
and such but given this is for fun I don't see it as a need :)
@romainmenke @Antonio-Laguna I think the only thing that you might want to consider adding before merging is fixing the |
@brandonmcconnell That is not a bug :)
Thank you all for the feedback! |
@brandonmcconnell @Afif13 This has now been released and is available here : https://www.npmjs.com/package/@csstools/postcss-gradient-stop-increments-experimental |
@romainmenke Incredible work on this. Thanks! |
see : w3c/csswg-drafts#8616
@Afif13 This is a prototype for the
++
syntax.It uses
calc
andmax
to ensure that the values increment in predictable ways.This won't work with
var()
because we can not statically determine ifvar()
will resolve to a color or a length. (+var()
is fine, we know that that must be a length)(for side-by-side examples : https://github.com/csstools/postcss-plugins/blob/relative-increments--sensible-boxer-dog-8f177aa015/experimental/postcss-gradient-stop-increments/test/examples/example.preserve-true.expect.css)