-
Notifications
You must be signed in to change notification settings - Fork 465
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
Improve color token operations #718
Conversation
I ran recently ran into this aswell - #695 @akhleung can you please give us some background on the intent and affect of |
@mgreter Let me see ... the As for the |
Also tagging @xzyfer |
Thanks for clarifying |
b83963a
to
0f658d0
Compare
0f658d0
to
8210d40
Compare
I cleaned up the commit and removed all references to |
Does this still break |
The PR itself looks good to me though! Nice work |
Indeed |
Ah so it's the spec that's incorrect, not the implementation? If that's the case 👍 🚢 |
Yep, there seem to be two edge cases that have changed in sass. One is the shortining of the color and the other is the "weird issue with unquote(0xf00)". Both issues are also related to 3.4 support blockers! and should be fixed by this. |
Sounds good! Ship it! FTR: the first edge case is due to changes in 3.4.0
|
Unfortunately your quote showed me another regression, and not sure how easy this is to fix. To do it properly I probably have to add and pass a few more tests that currently are not even in place. Souldn't be extremly hard, but this will take at least a few days till I can come up with a solution for this. |
Can you be more specific about the regression? Does it break existing It's important we show stability so people aren't afraid to depend on us.
|
What is your definition of "break" :) The output format of colors is not preserved as per your previous comment. I guess I should revert the Only problem I see is that we have two separate things going in |
If it's purely a matter of output formatting I'm fine with shipping with. AFAIK we never preserved output formatting and Sass only just introduced it as a 3.4 feature. |
We should make another issue to track the "preserve color formatting" feature 👍 |
52c88d2
to
dc8ebb7
Compare
This was pretty much a piece of cake once it was obvious I had to preserve the input format. t01: #abc; // => #abc
t02: #aabbcc; // => #aabbcc
t03: rgb(170, 187, 204); // => #aabbcc
t04: rgba(170, 187, 204, 1); // => #aabbcc I thought I would also need to look into these, but they seem to convert as before. So this made it a lot easier and it looks like this is now actually on par with current sass implementation. Yeah! ⛵ |
Nice I'm surprised Ruby sass doesn't preserve rgba formats. Looking through the Ruby sass issues tracker I found this explanation.
|
👍 🚢 🚀 |
dc8ebb7
to
276da5f
Compare
Ok, so travis-ci showed a regression with the second test this PR adresses in https://travis-ci.org/sass/libsass/jobs/44259916#L336 The issue was that |
9b18c05
to
35c55e1
Compare
35c55e1
to
ce36478
Compare
So travis is happy and @xzyfer feel free to hit the merge button if you agree! |
Done! |
This addresses a general issue how color tokens are handled.
I guess this is related to #558 and #629
This fixes the spec test
spec/libsass-todo-tests/libsass/colors
!This pretty sure addresses a bug, since
unquote("red")
andunquote(red)
would not be distinguishable, without propagating if the original variable was quoted or not. The first is a simple string, while the latter can be interpreted as a color (which matters for operations, like addition).input:
current:
after (as expected)
Unfortunately this breaks
spec/basic/16_hex_arithmetic
, but it somehow gets it half right and half wrong. It's still closer to the latest ruby sass version, but falls behind at one certain color shortening. Overall this looks pretty promising to get this fixed once and for all.I don't know what the implications are by "abusing"
needs_unquoting
and by removing the!lhs->is_delayed()
check! Therefore I leave this open as WIP for further review and comments!