-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Problems mixing-in rulesets defined using & combinator #1270
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
Comments
we had this bug before but I can't find it. The answer was to use extends. These are in 1.4.0 beta. It is unfortunately a limittation of the way mixins work that it would be difficult to compare to parts, e.g. |
I believe I found the issue you are talking about. Is it #1248 ? In any event, I don't think the extend functionality, as currently implement, fixes this problem. Suppose we update the sample above to use extend, like so: .label { &-success { background-color: blue; } } .mySuccessLabel:extend(.label-success) { } This produces no rules for Isn't this a bug? If not, then is there any workaround besides not using the & combinator in the original file? |
hrmm, your right.. I know why.. its because it treats it as
|
I've run into that problem just recently while delivering more nested rules for bootstrap 3.0.0-wip (labels component), removed the short name combination in the end and im awaiting for merge. Removed because that &-name combination didnt work and i really want to use bootstrap classes as mixins in my Less mastersheet instead writing ton of classes in my html markup. Other thing im interested is a ability to make loops - can anyone point me anywhere if thats something that is/will be supported? |
@Fowowski #1267 (comment) |
duplicate of #1196 |
When I use the & combinator to define a ruleset like this:
This correctly creates css like this:
However, when I try to add/mixin the label-success ruleset into another, like this:
It fails compilation with: "Name error: .label-success is undefined"
Here is the complete example showing the error:
I am using twitter bootstrap. They define labels and badges like above. https://github.com/twitter/bootstrap/blob/master/less/labels-badges.less#L52
The text was updated successfully, but these errors were encountered: