-
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
Functions named calc() or -*-calc() should not be called #1706
Comments
Ruby gives a warning: DEPRECATION WARNING on line 2 of libsass-todo-issues/issue_1706/input.scss: |
Spec added sass/sass-spec#608 |
I would promote this bug's fix being delayed until after #1776 is also resolved -- as it stands this bug is the best way to sidestep the issue. |
Started some initial progress, but fixing all different cases will take a bit longer. My WIP 3.4 branch currently yields (had to reduce seconds args to numbers) .test {
a: calc(1px * 1);
b: custom;
c: calc(9px); } |
IIRC Ruby Sass opts out of evaluating arguments for certain special functions like calc. I think this is ideal approach. https://github.com/sass/sass/blob/stable/lib/sass/scss/parser.rb#L932 There is ongoing discussion in Ruby Sass about how to best handle calc - sass/sass#818 |
I noticed the following today with 3.3.4: anything starting with calc seems to be skipped: @function calcfoo() { @return 'hello world'; }
@function barcalc() { @return 'hello world'; }
.test {
out: calcfoo();
out: barcalc();
} .test {
out: calcfoo();
out: "hello world"; } |
So is this the spec then? I have a group of functions that operate on @function calc(){ @return 'hello world'; }
@function -foo-calc(){ @return 'hello world'; }
@function foo-calc(){ @return 'hello world'; }
@function calc-foo(){ @return 'hello world'; }
.test {
out: calc(); // won't be processed
out: -foo-calc(); // won't be processed
out: foo-calc(); // ok?
out: calc-foo(); // ok?
} .test {
out: calc();
out: -foo-calc();
out: "hello world";
out: "hello world";
} |
I'm on my phone so can't verify but my intuition is that
|
Ruby SASS always outputs function arguments literally when the called function's name is
calc()
or-*-calc()
, even if a custom@function
with one of those names has been defined.As an aside, I have noticed that when
call()
is used (in both SASS and Libsass) the redefined functions are called. This behavior would need to be preserved to prevent a regression.Input SASS:
Ruby SASS Output (3.4.19):
Libsass Output (3.2.5):
The text was updated successfully, but these errors were encountered: