-
Notifications
You must be signed in to change notification settings - Fork 468
Description
I get different errors depending on the number of arguments accepted by the internal function - but the issue seems the same. There is no error when directly calling these functions with similar manually-constructed list-arguments, or when calling custom defined functions. The error only occurs when passing an arglist from a custom mixin/function along to an internal function…
Here, I'm calling adjust-color
with only one of the many optional arguments:
@function adjust(
$color,
$args...
) {
// not enough arguments for `adjust-color' on line x at column y
@return call('adjust-color', $color, $args...);
// this hack seems to fix the problem…
$hack: join(('adjust-color', $color), $args);
@return call($hack...);
}
.test {
color: adjust(#102030, -5);
}
/* expected result */
.test {
color: #0b2030;
}
When you pass in the exact number of arguments required, the error is slightly different - but the same hack works:
@function dark(
$color,
$args...
) {
// argument `$amount` of `darken($color, $amount)` must be a number
@return call('darken', $color, $args...);
// this hack seems to fix the problem…
$hack: join(('darken', $color), $args);
@return call($hack...);
}
.test {
color: dark(#102030, 5%);
}
/* expected result */
.test {
color: #0a131d;
}
This seems to be true in all versions of Libsass, but not in Ruby Sass. There's a demo on sassmeister, since libsass.ocbnet.ch won't allow me to bookmark this.
I'll add these tests to the spec, and comment with a link…