Collector variable structure if only one or zero arguments are collected
@SomMeri is already working on this.
Since Feb 3, 2015.
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.