You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it is usefull to have a base-class to put all your stuff into. This makes it easy to avoid conflicts with other elements on the page that are out of your control.
Most of the time you can just wrap your less code in a wrapper class but the reversed nesting with & breaks this approach.
That would not work since the textarea is not a child of the .form-control element but I understand where you are heading.
In this case it's not me using reverse nesting. What I'm doing is putting bootstrap in a wrapper class. They are using reverse nesting. The quick(er) fix would of course be to make them stop using it but I chose to post it here since I perceive this as a shortcoming of lesscss.
@jaanush, I suspect what you name a "base class" is simply a "namespace" (more details here), though to give some examples of using namespaces for your use-case we need to know how exactly .form-control is planned to be used.
I remember very similar discussion at stackoverflow recently, there's a solution if you simply need to prepend all bootstrap selectors with some extra class/id:
Yes, that is exactly what I do with the . bs3 class but I chose not to call it namespace since that's something a bit different.
If you look at my original example you can se how the reversed nesting prepends the textarea element to te "namespace" so it becomes textarea.bs3. This behavior breaks your example.
Activity
Soviut commentedon Dec 3, 2013
Why are you using the
&symbol that way? Why not just use normal nesting?Regardless, a "parent depth" has been discussed in other issues. #1075
jaanush commentedon Dec 3, 2013
That would not work since the textarea is not a child of the .form-control element but I understand where you are heading.
In this case it's not me using reverse nesting. What I'm doing is putting bootstrap in a wrapper class. They are using reverse nesting. The quick(er) fix would of course be to make them stop using it but I chose to post it here since I perceive this as a shortcoming of lesscss.
seven-phases-max commentedon Dec 3, 2013
@jaanush, I suspect what you name a "base class" is simply a "namespace" (more details here), though to give some examples of using namespaces for your use-case we need to know how exactly
.form-controlis planned to be used.I remember very similar discussion at stackoverflow recently, there's a solution if you simply need to prepend all bootstrap selectors with some extra class/id:
jaanush commentedon Dec 4, 2013
Yes, that is exactly what I do with the . bs3 class but I chose not to call it namespace since that's something a bit different.
If you look at my original example you can se how the reversed nesting prepends the textarea element to te "namespace" so it becomes textarea.bs3. This behavior breaks your example.
seven-phases-max commentedon Dec 4, 2013
No, it does not. This solution is not the same as you have already tried. Notice the extension of the imported file and
(less)modifier.jaanush commentedon Dec 11, 2013
Sorry, missed that small distinction. That looks like it should work
lukeapage commentedon Dec 22, 2013
tbh I'm a bit lost now.. can this be closed?
seven-phases-max commentedon Dec 22, 2013
I think it can be closed (since there's no way to "fix" it and in the rest it is a sort of #1075 variation)
jonschlinkert commentedon Dec 22, 2013
done