Skip to content
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

Important on parametrized mixin #2404

Merged
merged 1 commit into from
Jan 26, 2015

Conversation

SomMeri
Copy link
Member

@SomMeri SomMeri commented Jan 21, 2015

This should fix #2394

The issue was not with mixin being parametric, the problem was that variables of nested mixins did not evaluated properly.

The !important flag on mixin call prevented proper evaluation of variables inside nested mixins. less#2394
}), this.strictImports);
};
Ruleset.prototype.matchArgs = function (args) {
this.rules = this.rules.map(function (r) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially concerned, but this is only used from one place which has already copied the Ruleset.
Its a good change - but for my own curiousity, what is wrong with the new Ruleset that is causing un-eval'd rules?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would fail:

size(@aaa) {
  .set-width(@aaa) {
    width: @aaa; // this line is failing
  }
  .set-width(@aaa);
}
.when-calling-nested-issue-2394 {
  .size(10px) !important;
}

with:

NameError: variable @aaa is undefined in c:\data\meri\less.js\tests\test.less on line 3, column 12:
2   .set-width(@aaa) {
3     width: @aaa;
4   }

I could not figure why. I tried to find missing property in new ruleset, compare new properties with old ones etc. Since the method was called only from one place, I gave up and did what worked.

This test case is inside mixins-important.less file.

lukeapage added a commit that referenced this pull request Jan 26, 2015
@lukeapage lukeapage merged commit 3571cad into less:master Jan 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

!important keyword with parametric mixin
2 participants