2

If the purpose of _extend.less in a custom theme is to "extend" a style, what does this really mean? Should it be used in the following cases:

  • Change the value of an existing attribute of an existing style
  • Add a new attribute to an existing style that already has other attributes defined
  • Add a new attribute to an existing style that does not have any attributes defined (these do exist in the blank theme)
  • Remove an attribute from an existing style (you just want the inherited value)
  • Add a new style
1

This actually is quite a hard question. simply put extending means all of the things you mentioned.

https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/css-guide/css_quick_guide_approach.html

Now here is where it becomes difficult.. There is no clear split line to when you put a new rule in an _extend.less or when you just simply override the module's styling within your theme's override of that module. The best answer I can give you for this is, do whatever feels good to you. (Because at the end of the day it doesn't even matter that much :p)

  • I suspected as much. But if it doesn't matter that much, why make the distinction at all? Does it have to do with maintainability? with intelligibility? with performance? – Amblymoron Jul 25 '18 at 14:54
  • I suspect maintainability as magento can at times be everything but intelligible. Magento 2's theme does have a huge focus on configurability where you can do huge amounts of styling with a simple lib_ mixin. And there are also huge files full of variables for easy theming. So the focus is definitly on maintainability and configurability, as for why they made the destinction in this particular case, i honestly couldn't tell you. I would assume for the same reasons. – Pascal Wientjes Jul 25 '18 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.