-
Notifications
You must be signed in to change notification settings - Fork 1
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
Can we simplify a variable with ruleset value (aka DR) declaration? #14
Comments
There's hidden @var: {...} foo {...} can be interpreted either as "DR decl. followed by @dr: { // or #ns()
nested-dr: {...}
another-dr: {...}
} it also becomes quite ambiguous to detect if Personally I'm not quite sure if me is +1 or -1. |
Part of my thinking is the discussions to align DRs and mixins a bit more (the latter of which does not need a semicolon after its ruleset). Not just that, but nowhere else in Less / CSS does associating a ruleset with a node require either a colon or a terminating semi-colon after the closing brace. The closing brace is always the end of that node everywhere else in the language. Such that when using rulesets, I get errors for omitting a semi-colon after the final brace constantly, so it's a personal pet peeve. As to: b) assigning to a property - I don't see the need, nor limiting. The reason for referencing properties is to use their values in other calculations, but the given use case is for valid properties. Yes, properties can be hackable when we allow referencing beyond standard CSS properties, but we don't have to design a verbose syntax around a specific type of non-designed hackability that has a bunch of workarounds to do the same thing. In CSS, a ruleset is an implied closing |
Just a remark for:
It can't be because the syntax is not even invented (the invented syntax is:
That's the trick. This is not to say "we don't need this", but to only clarify why "CSS rulesets and mixins don't need |
Actually, it's part of neither. It's a statement terminator, and in CSS, as you say, some statements can have an implied termination, such as the end of a block. But I know what you're trying to say, which is that the ruleset is the value assigned to the variable; therefore it follows variable syntax. Sure, yes, BUT, it feels like this to me: .mixin // identifier
{ // start of block associated with identifier
prop: val; // rules
} // termination of both block and statement (statement being associating identifier with block)
@dr: // variable identifier with explicit assignment char
{ // start of block associated with identifier
prop: val; // rules
} // termination of block
; // termination of statement Not that Less could necessarily parse those newlines, but I see those identifier / blocks as comparative. |
Just to address rulesets as lists, there are other cases where we require assignment to a var first, so you could do: @dr1: {
prop1: foo;
}
@dr2: {
prop2: foo;
}
@dr-list: @dr1 @dr2;
.some-mixin(@dr-list); Seems like a small requirement for that use case, which is probably an edge case. |
The propose is to allow omitting the terminal
;
in:The text was updated successfully, but these errors were encountered: