Skip to content

Commit 3571cad

Browse files
committed
Merge pull request #2404 from SomMeri/important-with-nested-mixin-v2-2394
Important on parametrized mixin
2 parents ab96e71 + d0e217e commit 3571cad

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

lib/less/tree/ruleset.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ Ruleset.prototype.evalImports = function(context) {
182182
}
183183
};
184184
Ruleset.prototype.makeImportant = function() {
185-
return new Ruleset(this.selectors, this.rules.map(function (r) {
186-
if (r.makeImportant) {
187-
return r.makeImportant();
188-
} else {
189-
return r;
190-
}
191-
}), this.strictImports);
192-
};
193-
Ruleset.prototype.matchArgs = function (args) {
185+
this.rules = this.rules.map(function (r) {
186+
if (r.makeImportant) {
187+
return r.makeImportant();
188+
} else {
189+
return r;
190+
}
191+
});
192+
return this;
193+
};Ruleset.prototype.matchArgs = function (args) {
194194
return !args || args.length === 0;
195195
};
196196
// lets you call a css selector with a guard

test/css/mixins-important.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@
4343
.class .inner {
4444
test: 9;
4545
}
46+
.when-calling-nested-issue-2394 {
47+
width: auto !important;
48+
}
49+
.when-calling-nested-with-param-issue-2394 {
50+
width: 10px !important;
51+
}

test/less/mixins-important.less

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,15 @@
2323
.mixin !important;
2424
.mixin(9);
2525
}
26+
.size(@aaa: auto) {
27+
.set-width(@aaa) {
28+
width: @aaa;
29+
}
30+
.set-width(@aaa);
31+
}
32+
.when-calling-nested-issue-2394 {
33+
.size() !important;
34+
}
35+
.when-calling-nested-with-param-issue-2394 {
36+
.size(10px) !important;
37+
}

0 commit comments

Comments
 (0)