-
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
Allow for pseudo-classes to be used as mixins #1630
Comments
👍 |
An example how to use extend to solve your problem with the extend keyword. If you do this:
then less.js will add #b selector into all rulesets with #a a selector:
I will close this as a duplicate, because the issue #1048 covers the same problem. If you think that extend does not solve your problem, feel free to make your case there. The feature is more likely to be added if we known about something that is not possible to achieve without it. |
Thank you for your answer. |
This would be particularly useful when importing an external less library that defines rules on pseudo-classes, an you want to mixin those rules in another class that will be applied to an element that doesn't support the pseudo-class.
See the following example to understand what I mean:
should compile to:
I've happened to need this while working with Bootstrap 3: I was trying to mix in the rules from
.form-element:focus
into another class that I wanted to apply to adiv
, which doesn't support the:focus
pseudo-class. So, I ended up manually copying all the rules from the bootstrap pseudo-class into my other class, which is a really poor solution in a less-based project.The text was updated successfully, but these errors were encountered: