-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
By collector variables I mean either @arguments variable or any mixin parameter declared with ....
If collector collected multiple values, then it contains a list. However, if it collected only on variable, then it does not contains a list. It contains that one variable. That makes it impossible to differentiate between these two things:
.mixin(1, 2, 3)// three parameters.mixin(1, 2, 3;)// one parameter
Full test case:
.mixin(@first, @rest...) {
rest-length: length(@rest);
rest: ~`"@{rest}"`;
}
div-1 {
.mixin(box-shadow 0.2s linear);
}
div-3 {
.mixin(box-shadow 0.2s linear, color .4s .2s ease);
}
div-2 {
.mixin(box-shadow 0.2s linear, color .4s .2s ease, jabba dabba);
}
current output:
div-1 {
rest-length: 0;
rest: ;
}
div-2 {
rest-length: 4;
rest: [color, 0.4s, 0.2s, ease];
}
div-2 {
rest-length: 2;
rest: [color 0.4s 0.2s ease, jabba dabba];
}
Expected output:
div-1 {
rest-length: 0;
rest: []; // maybe?
}
div-2 {
//here is difference. It is still impossible to tell comma/space difference, but
//it is at least possible to know the right number of parameters
rest-length: 1;
rest: [[color, 0.4s, 0.2s, ease]];
}
div-2 {
rest-length: 2;
rest: [[color, 0.4s, 0.2s, ease], [jabba dabba]];
}
Background: I was trying to find out how LessHat could work if we would fix #1939 (pull request #1941). Spaces/commas/argument separator difference is lost in less->js conversion. Which might be ok if would could partially deduce them from structure which is impossible.
LessHat current prints @arguments into string and then uses javascript to parse that string.