-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Please provide a way to merge lists #2467
Comments
Since the plugin subsystem is here and fully functional I wonder if we consider a stuff like this to be added instantly to the core anymore. A plugin providing these functions is rather easy to code, I mean of course this stuff can get into the core if considered to be very useful eventually, but shouldn't built-in-function-requests approach from now-on be something like "find some function useful/important? implement it yourself via plugin and let it preach on its own"? :) |
Good point. |
@seven-phases-max I think that's a good point. It was @cloudhead's thought that 99% of what was needed was implemented by version 1.3, basically. We could start slimming down the core and actually move more pieces to plugins to keep something that executes quickly for more people, and let the other 1% pick and choose what pieces they need in their Less file. Express (and many other frameworks) went the route of separating pieces out of core once they had a reliable plugin system. I think @rjgotten's recent pull request actually takes us a big leap forward in that direction (although I'd like to see browser support). (Also, ironic since this is your feature request, @rjgotten 😉 ) So something like this could eventually ship with Less, but not be loaded automatically by Less, as in:
So, I too would like things to move more in that direction, as it gives us more proofs-of-concept to make the plugin system more robust. |
Yeah, I had the compiler's source open to study how to add custom functions to fullfill my own feature request. Then I had a 'what the hell; why not...' moment, going with the flow and rolling out a first proof-of-concept for that And then I realized I didn't need this as an explicit feature request anymore. ^_^ |
So, should we close this, as it sounds like you'll take the plugin approach? |
I wonder if we need to add |
Or "Implement as plugin" (or something shorter?) I like this. I think we can close open issues faster if we can be can simply ask: "Is this necessary for 99% of Less users". If not, it should be a plugin. |
And I also like the idea of optional (but included) plugins. So, plugins maintained by core team. |
Yes. Unless ofcourse you want to tack on a 'implement as plugin' label. |
OK, to not spin out all that bureaucracy, just closing. |
While there are
extract
andlength
functions available, there is currently no function available to merge two lists together. This is not equivalent to simply listing two list-type variables in succession, which produces a list of lists. E.g.Using a
@param...
rest parameter or the special@arguments
variable and passing in two lists similarly produces (or atleast; seems to produce) a list of lists. These three cases are all behaving as expected, ofcourse: it should be possible to assemble lists of lists.However, this leaves us without a way to concatenate lists or to concatenate elements to existing lists. As the LESS language heavily relies on tail recursion for iteration, I'd expect there to be a common supported pattern to aggregate head values into one joined list as is common with list manipulation in functional languages (with or without the use of list comprehension).
I'm thinking of something like the following:
There is a
+:
syntax available for merging CSS properties into lists as well. An alternative over ajoin
function would be to widen that syntax to include variable support. Somehow that does not feel quite right though.The text was updated successfully, but these errors were encountered: