-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Bug: extend doesn't work when appended on nested selector with & #2206
Comments
Note that these test cases work: .icon-heart {
content: '\2661';
}
.test {
&.active:extend(.icon-heart) {}
} .myModule {
.test {
.active:extend(.icon-heart) {}
}
} |
I think another relevant but simplier example is the following: .wrapper {
.bar {
text-decoration:underline;
}
.foo {
&:extend(.bar all );
color:red;
}
} That results to: .wrapper .bar,
.wrapper .wrapper .foo {
text-decoration: underline;
}
.wrapper .foo {
color: red;
} Instead of: .wrapper .bar,
.wrapper .foo {
text-decoration: underline;
}
.wrapper .foo {
color: red;
} |
That is another case @kdask-devnull and (currently) proper behaviour. Like mentioned in the Extend "all" section:
In your example LessJS just takes the selector .wrapper {
.bar {
text-decoration: underline;
}
.foo {
&:extend(.wrapper .bar all);
color: red;
}
} (What if there is a global |
I see, thanks for your reply, but doesn't this conflicts with the nested rules logic? .wrapper {
@import "bootstrap/less/bootstrap.less";
} This will have an effect that the 3rd party mixins would not be valid anymore. .make-row(@gutter: @grid-gutter-width) {
margin-left: (@gutter / -2);
margin-right: (@gutter / -2);
&:extend(.clearfix all);
} |
@kdask-devnull |
can't you fix this by putting some rules in that empty selector block? |
@macgyver The easiest workaround (if you stepped this issue) is given in the initial post itself, i.e. just put |
I can fix this, it is just small change. However, I have one question before I do so. How should following compile:
a.) like this:
b.) or rather like this:
|
It's
|
definitely (a). Because its equivalent to this..
which is consistent with less - it does the pulling out of the scopes before processing the extend. In addition its as Max pointed out.. if we got (b) there would be no way to not get (b) where as with (a) a user has the option of adding (b). |
Tested this with http://less2css.org/, experienced it in a project with LessJS 1.7.1:
LessCSS:
Expected:
Result:
The text was updated successfully, but these errors were encountered: