mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Merge pull request #2497 from calvinjuarez/ruleset-as-default-arg
Allow detached rulesets as mixin argument defaults
This commit is contained in:
@@ -704,10 +704,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
||||
expressionContainsNamed = true;
|
||||
}
|
||||
|
||||
// we do not support setting a ruleset as a default variable - it doesn't make sense
|
||||
// However if we do want to add it, there is nothing blocking it, just don't error
|
||||
// and remove isCall dependency below
|
||||
value = (isCall && parsers.detachedRuleset()) || parsers.expression();
|
||||
value = parsers.detachedRuleset() || parsers.expression();
|
||||
|
||||
if (!value) {
|
||||
if (isCall) {
|
||||
|
||||
@@ -69,3 +69,8 @@ html.lt-ie9 header {
|
||||
.a {
|
||||
test: test;
|
||||
}
|
||||
.argument-default {
|
||||
default: works;
|
||||
direct: works;
|
||||
named: works;
|
||||
}
|
||||
|
||||
@@ -100,4 +100,13 @@ header {
|
||||
@my-mixins();
|
||||
.a {
|
||||
.mixin();
|
||||
}
|
||||
// as mixin argument default
|
||||
.mixin-definition(@a: {}; @b: {default: works;};) {
|
||||
@a();
|
||||
@b();
|
||||
}
|
||||
.argument-default {
|
||||
.mixin-definition();
|
||||
.mixin-definition({direct: works;}; @b: {named: works;});
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
.mixin-definition(@a: {
|
||||
b: 1;
|
||||
}) {
|
||||
@a();
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
ParseError: Unrecognised input in {path}detached-ruleset-4.less on line 3, column 4:
|
||||
2 b: 1;
|
||||
3 }) {
|
||||
4 @a();
|
||||
Reference in New Issue
Block a user