-
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
Implemented named arguments #268
Conversation
This is great! |
Yeah, this looks awesome. |
Nice! |
This should really be a second pull request. Just "fully" implemented the Enjoy |
Another killer feature! Here's the usage. This:
Becomes:
This removes the need for duplicate rules in separate blocks, and also overcomes the need to match the structure exactly within those blocks to overcome specificity issues. e.g. This wouldn't have worked for the above:
Nice work! |
Just rebased to make it easier to merge. Also squashed the named arguments feature into a single commit. Original branch at jamesfoster@req268 |
OMG +1 great work |
This has been on my wish list for a very long time, and I'd love to see it in one form or another. |
Do want |
+1 |
2 similar comments
+1 |
+1 |
Hard to think of anything I've wanted more than a parent selector. Great work! |
Really looking forward to being able to use this. |
Thanks for all the comments. This is one of those things I've wanted for a while myself too. my friend brought it up some time later and the solution just hit me. Not sure what's holding up the merge but @cloudhead assures me it's coming. |
773229f applies cleanly against the current master but does not work (causes a JS error); 2e042e9 applies and works fine. I wonder if it would be easier to get this landed if it’s split into two pull reqs? |
ok. thanks for this. I'll split the requests up and add the above case to the tests and fix it. |
@jamesfoster Your parent selector fixes were merged, but did you ever resubmit the named parameters enhancement. I really, really, really think that this is a killer feature, and deserves another PR. |
Any progress on this ticket? |
Would love to see named arguments added. |
Currently working on an updated version of this here; will be submitting another pull request after I've tested it a bit more thoroughly. |
Woah, I'm tweeting this, cheers mate! |
What ever happened to this? I found myself needing named arguments and wishing LESS had it. Seeing a pull request open for a year that has it is pretty frustrating. I see why people are switching to stylus/sass. |
…tor. ''' .foo { .bar & { &:hover { color: orange; } } } ''' now outputs ''' .bar .foo:hover { color: orange; } '''
Rebased and fixed issue with trailing space. |
+1 |
Implemented named arguments
|
Hey Alexis,
Here's an implementation of named parameters. For example:
If you wanted to override the 5th argument you would need to know the default value for the first 4 before supplying the 5th and if the defaults changed you now have to find everywhere where you've done this.
Not good.
Now you just specify the name of the argument you want to override.
It might be nice to throw an error if you place any named arguments before any "positional" arguments. as it stands it works regardless but you may get unexpected results.
Cheers
James