Skip to content

Commit

Permalink
Merge pull request #2404 from SomMeri/important-with-nested-mixin-v2-…
Browse files Browse the repository at this point in the history
…2394

Important on parametrized mixin
  • Loading branch information
lukeapage committed Jan 26, 2015
2 parents ab96e71 + d0e217e commit 3571cad
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/less/tree/ruleset.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ Ruleset.prototype.evalImports = function(context) {
}
};
Ruleset.prototype.makeImportant = function() {
return new Ruleset(this.selectors, this.rules.map(function (r) {
if (r.makeImportant) {
return r.makeImportant();
} else {
return r;
}
}), this.strictImports);
};
Ruleset.prototype.matchArgs = function (args) {
this.rules = this.rules.map(function (r) {
if (r.makeImportant) {
return r.makeImportant();
} else {
return r;
}
});
return this;
};Ruleset.prototype.matchArgs = function (args) {
return !args || args.length === 0;
};
// lets you call a css selector with a guard
Expand Down
6 changes: 6 additions & 0 deletions test/css/mixins-important.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@
.class .inner {
test: 9;
}
.when-calling-nested-issue-2394 {
width: auto !important;
}
.when-calling-nested-with-param-issue-2394 {
width: 10px !important;
}
12 changes: 12 additions & 0 deletions test/less/mixins-important.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@
.mixin !important;
.mixin(9);
}
.size(@aaa: auto) {
.set-width(@aaa) {
width: @aaa;
}
.set-width(@aaa);
}
.when-calling-nested-issue-2394 {
.size() !important;
}
.when-calling-nested-with-param-issue-2394 {
.size(10px) !important;
}

0 comments on commit 3571cad

Please sign in to comment.