-
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
variables losing zeros #1140
Comments
Valid, see the same with perl-libsass:
IMO it should be quite trivial to fix this "edge" case! |
Fixed in 3.2.1 |
Your fix may have gone a tiny bit too far. In 3.2.1 for $foo: 123px; .m { width: $foo; } compiles to .m {
width: 123.0px; } I don't think adding |
Are right, yes that's a bug, but it doesn't change the semantic of the code which certainly an improvement. |
Oh, it even got worse: $foo: 123.4px; .m { width: $foo; } compiles to .m {
width: 123.0px; } so now we're actually losing precision |
@rodneyrehm I can't reproduce this with give code. Are you sure you're on 3.2.1? $ sassc --precision=0 test.scss
.m {
width: 123.0px; }
$ sass --precision=0 test.scss
.m {
width: 123.0px; }
$ sassc --precision=5 test.scss
.m {
width: 123.4px; }
$ sass --precision=5 test.scss
.m {
width: 123.4px; } |
Yes and no. Ruby Sass adds the The bug here is that we're adding to all numbers regardless. |
I see your |
If this what you desire there is no config or flag to achieve this. |
No, it's not what I desire. What I want is the ability to tell libsass to use its default value for precision. I assumed Maybe all of this is really just based on me not understanding that |
The default value is 5 (was changed some time ago from 3) and no, you cannot tell libsass to use the default again, since it is really only set when the context gets initialized (so you cannot "unset" a config option currently, once it is set), If we would add such a functionality I rather would add specific |
As @mgreter said the default is 5 the same as Ruby Sass. We copy Ruby Sass where possible. There is talk of this changing in the future though - sass/sass#1122 |
ok, preventing to set the precision seems like the easiest (and apparently future-proof) way. thanks! |
No problem. Apologies for the confusion. We're tracking the extra |
No need to apologize, obviously I wasn't able to make clear what I wanted… |
Sorry for the weird title, I'm not sure how to even describe this properly.
given the input
I get the output
note how
20px
turned into2px
. I see the same behavior for0.1px
turning intopx
.I've tracked the issue down to
sass_option_set_precision(ctx_opt, 0);
being the culprit. Not setting a precision, or setting any precision other than0
works. I think I remember reading something about0
being the libsass default. But I can't support that by linking to code. Judging from sass_context.cpp and inspect.cpp I'd assume the default is5
.I'm not sure if this is an issue with code, the documentation, or me being daft (again).
The text was updated successfully, but these errors were encountered: