-
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
how to override a mixin ?? #2532
Comments
Then just set it. You do realize that setting a Either way you can't override a mixin[1]. Just like you can't override a CSS class for example, but just like in CSS you can cascade it and override its properties. [1] - unless the initial mixin is defined with P.S. Also please use backticks to format your code. P.P.S. Speaking of the use-case example, it's rather strange (to say at least), thought I guess Bootstrap folks will tell you the same there in more details: |
I'm pretty sure it should be a duplicate of this FR somewhere around though I can't find it right now (related but not the same: #1372). |
height: auto can make thumbnail looks weird , .img-responsive, .thumbnail>img, .thumbnail a>img, .carousel-inner>.item>img, .carousel-inner>.item>a>img {
display: block;
max-width: 100%;
height: auto;
} in this case that I have some images use the .thumbnail class,but images' size is different,I want to force set set same size to make sure the page not being mass,but this height:auto style stop me doing it,that's why I think it's wrong. |
Again: please use backticks to format your code.
I think this is more like a question for Bootstrap guys, but in short: |
Anyway,thanks for your kind reply. Goodnight! |
It would be great to consider some syntax to make this possible, it seems completely backwards to me. It makes working with Bootstrap (I would guess the most widely used instance of less) awkward when you need to make changes. If i want to change the padding of buttons by 2px (for example) my CSS gets out put as .btn {
/* ... */
padding: 8px 24px;
padding: 6px 24px;
/* ... */
} Which just seems weird, there is no benefit over simply adding |
@OrganicPanda .row {
display: table; // non flexbox browsers
display: flex;
} Other tools like Pleeeease (or however many e's it has), or other such CSS shimming tools can determine which properties can be safely dropped / minified based on the a) values used and the b) browsers targeted, c) the current usage of those browsers. Tracking all of those components and how they apply to each property is not the goal of Less. Less is a tool for writing CSS, but it doesn't have an opinion on whether your CSS properties are valid or redundant in a particular browser. |
I guess I wasn't clear about my issue. Bootstrap has variables and mixins, overriding variables works as you would expect but overriding mixins doesn't match the behaviour, which is disappointing. Bootstrap has a mixin to create various button sizes, I would like to change that behaviour to do something different but less instead applies their mixin and then mine which is not what I would expect. Overriding mixins is not out of the scope of less because they are a core construct of less and not part of css, they should match how less already deals with variables rather than having two different approaches in the same language. I hope that clarifies that I'm not looking for auto-deduping of properties - that is obviously a terrible idea :) |
It's not a problem to make a mixin overridable in Less by now (the easiest way is to add |
I suppose from the language design point of view maybe you are right to not include it but from a users point of view that is a very disappointing answer that, in practise, makes it hard to work with the most ubiquitous library currently available. Thanks for taking the time to answer anyway |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
in bootstrap there is a mixin
// Responsive image
//
// Keep images from scaling beyond the width of their parents.
note that the last statement-> height:auto ,This is really bad idea,I need to set a fixed size image attribute like
<img width="300px" height="200px".../>
,but you know it don't work, so i want to override the mixin to this:you know it don't work too,so bad...
bootstrap shouldn't set the style,and less should let me override it,is there any way to fix the problem?
The text was updated successfully, but these errors were encountered: