Difference between _module.less and _extend.lesssource/lib not available in magento 2 frontend designCSS and JS is not loading in new theme@media-common - Why do we need to use this?& when (@media-common = true) - Changes not picked up unless I do static-content-deployMagento 2 CSS Media Queries not working onBest way to extend module less found in web/css/source/module, like _minicart.less?Difference between _extend.less . and _extends.lessUsing media queries inError: Exception #0 (InvalidArgumentException): Unable to serialize value - Produced by custom Theme
Huffman Code in C++
How to preserve a rare version of a book?
Do Jedi mind tricks work on Ewoks?
Debian 9 server no sshd in auth.log
GitLab account hacked and repo wiped
Summer '19 Sandbox error: String index out of range: 0: Source
What is more safe for browsing the web: PC or smartphone?
How did the Force make Luke hard to hit in the Battle of Yavin?
What does the phrase "go for the pin" mean here?
How is trade in services conducted under the WTO in the absence of the Doha conclusion?
Ab major 9th chord in Bach
How important are good looking people in a novel/story?
What does the coin flipping before dying mean?
Changing stroke width vertically but not horizontally in Inkscape
Efficient deletion of specific list entries
My large rocket is still flipping over
Emergency stop in plain TeX, pdfTeX, XeTeX and LuaTeX?
How can I finally understand the confusing modal verb "мочь"?
Make me a minimum magic sum
Installing Debian 10, upgrade to stable later?
Justification of physical currency in an interstellar civilization?
Picking a theme as a discovery writer
Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?
The selling of the sheep
Difference between _module.less and _extend.less
source/lib not available in magento 2 frontend designCSS and JS is not loading in new theme@media-common - Why do we need to use this?& when (@media-common = true) - Changes not picked up unless I do static-content-deployMagento 2 CSS Media Queries not working onBest way to extend module less found in web/css/source/module, like _minicart.less?Difference between _extend.less . and _extends.lessUsing media queries inError: Exception #0 (InvalidArgumentException): Unable to serialize value - Produced by custom Theme
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Is there any difference between extending a theme using _module.less
and _extend.less
? And what is the best practice when extending a module/theme?
My first thought was it's better to use _module.less
when styling a new module, and _extend.less
when extending a module. But Luma uses _module.less
when extending the blank theme so that theory has gone out the window.
The only difference I can see between them is _module.less
is imported before the responsive library and _theme.less
where as _extend.less
is imported after them.
This is the order they are imported in vendor/magento/theme-frontend-blank/web/css/styles-l.less
//
// Blank theme desktop styles
// _____________________________________________
// These desktop styles are additional to mobile
//
// Global lib + theme styles
// ---------------------------------------------
@import '_styles.less';
@import (reference) 'source/_extends.less';
//
// Magento Import instructions
// ---------------------------------------------
//@magento_import 'source/_module.less'; // Theme modules
//@magento_import 'source/_widgets.less'; // Theme widgets
//
// Media queries collector
// ---------------------------------------------
@import 'source/lib/_responsive.less';
@media-target: 'desktop'; // Sets target device for this file
@media-common: false; // Sets not to output common styles
//
// Global variables override
// ---------------------------------------------
@import 'source/_theme.less';
//
// Extend for minor customisation
// ---------------------------------------------
//@magento_import 'source/_extend.less';
magento2 frontend view less-css less
add a comment |
Is there any difference between extending a theme using _module.less
and _extend.less
? And what is the best practice when extending a module/theme?
My first thought was it's better to use _module.less
when styling a new module, and _extend.less
when extending a module. But Luma uses _module.less
when extending the blank theme so that theory has gone out the window.
The only difference I can see between them is _module.less
is imported before the responsive library and _theme.less
where as _extend.less
is imported after them.
This is the order they are imported in vendor/magento/theme-frontend-blank/web/css/styles-l.less
//
// Blank theme desktop styles
// _____________________________________________
// These desktop styles are additional to mobile
//
// Global lib + theme styles
// ---------------------------------------------
@import '_styles.less';
@import (reference) 'source/_extends.less';
//
// Magento Import instructions
// ---------------------------------------------
//@magento_import 'source/_module.less'; // Theme modules
//@magento_import 'source/_widgets.less'; // Theme widgets
//
// Media queries collector
// ---------------------------------------------
@import 'source/lib/_responsive.less';
@media-target: 'desktop'; // Sets target device for this file
@media-common: false; // Sets not to output common styles
//
// Global variables override
// ---------------------------------------------
@import 'source/_theme.less';
//
// Extend for minor customisation
// ---------------------------------------------
//@magento_import 'source/_extend.less';
magento2 frontend view less-css less
add a comment |
Is there any difference between extending a theme using _module.less
and _extend.less
? And what is the best practice when extending a module/theme?
My first thought was it's better to use _module.less
when styling a new module, and _extend.less
when extending a module. But Luma uses _module.less
when extending the blank theme so that theory has gone out the window.
The only difference I can see between them is _module.less
is imported before the responsive library and _theme.less
where as _extend.less
is imported after them.
This is the order they are imported in vendor/magento/theme-frontend-blank/web/css/styles-l.less
//
// Blank theme desktop styles
// _____________________________________________
// These desktop styles are additional to mobile
//
// Global lib + theme styles
// ---------------------------------------------
@import '_styles.less';
@import (reference) 'source/_extends.less';
//
// Magento Import instructions
// ---------------------------------------------
//@magento_import 'source/_module.less'; // Theme modules
//@magento_import 'source/_widgets.less'; // Theme widgets
//
// Media queries collector
// ---------------------------------------------
@import 'source/lib/_responsive.less';
@media-target: 'desktop'; // Sets target device for this file
@media-common: false; // Sets not to output common styles
//
// Global variables override
// ---------------------------------------------
@import 'source/_theme.less';
//
// Extend for minor customisation
// ---------------------------------------------
//@magento_import 'source/_extend.less';
magento2 frontend view less-css less
Is there any difference between extending a theme using _module.less
and _extend.less
? And what is the best practice when extending a module/theme?
My first thought was it's better to use _module.less
when styling a new module, and _extend.less
when extending a module. But Luma uses _module.less
when extending the blank theme so that theory has gone out the window.
The only difference I can see between them is _module.less
is imported before the responsive library and _theme.less
where as _extend.less
is imported after them.
This is the order they are imported in vendor/magento/theme-frontend-blank/web/css/styles-l.less
//
// Blank theme desktop styles
// _____________________________________________
// These desktop styles are additional to mobile
//
// Global lib + theme styles
// ---------------------------------------------
@import '_styles.less';
@import (reference) 'source/_extends.less';
//
// Magento Import instructions
// ---------------------------------------------
//@magento_import 'source/_module.less'; // Theme modules
//@magento_import 'source/_widgets.less'; // Theme widgets
//
// Media queries collector
// ---------------------------------------------
@import 'source/lib/_responsive.less';
@media-target: 'desktop'; // Sets target device for this file
@media-common: false; // Sets not to output common styles
//
// Global variables override
// ---------------------------------------------
@import 'source/_theme.less';
//
// Extend for minor customisation
// ---------------------------------------------
//@magento_import 'source/_extend.less';
magento2 frontend view less-css less
magento2 frontend view less-css less
asked May 20 '16 at 9:48
Ben CrookBen Crook
9,3692577
9,3692577
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
The answer is somewhat hidden in the Magento docs:
Extending a theme using _extend.less is the simplest option when you are happy with everything the parent theme has, but want to add more styles.
Read more here
Use _module.less when you want to make major changes in styles for a module and use _extend.less for minor adjustments. You'll find more examples on how to override component styles in the link above.
1
I've read that but it doesn't really explain why, it sounds like there's no reasoning behind it. I'm trying to figure out if there's any difference. I've been using _extend.less for all my changes as I prefer consistency to using something because 'Magento said so'.
– Ben Crook
May 23 '16 at 6:41
1
@BenCrook if my reading these past few days serves me right, no. If someone were to add any.less
file in their theme with the same path as a file in the parent theme/module, that is an override. You could probably verify by creating a blank _module.less into your theme, and seeing if the original styles apply.
– Darren Felton
Dec 14 '16 at 14:20
1
After aphp bin/magento setup:static-content:deploy
, you can look intopub/static/frontend/<vendor>/<themeName>/<locale>/css/
andpub/static/frontend/<vendor>/<themeName>/<locale>/<Module_Name>/css/
and there will be symbolic links for *.less files to either your theme, or the module/parent theme it is coming from.
– Darren Felton
Dec 14 '16 at 14:23
1
That is correct _module.less overrides the parent less file, there is no inheritance or merging. I realise I could have made that more clear in my original answer :)
– c.norin
Dec 15 '16 at 12:24
1
@MattCosentino I realise this reply comes very late, but I'll leave this here in case someone stumbles upon it: Please note the difference between _extends.less and _extend.less. The _extend.less files can be added to any module context, to extend styles from a parent theme. The _extends.less is located in the root of the theme and is used to extend existing utilities (refer to <project>/lib/web/css/docs/source/_utilities.less).
– c.norin
Jan 15 '18 at 17:01
|
show 3 more comments
The _extends.less
with an S at the end within the Blank Theme, is a file where they created all the classes that can be extended via LESS
later within the theme, without the need of creating new components or modular structure for style changes. -> For those who don't believe me: https://github.com/magento/magento2/blob/2.3-develop/app/design/frontend/Magento/blank/web/css/source/_extends.less check the file.
The _extend.less
without the S at the end, is for when you are 99% happy with what the parent theme has and you just need to change a couple of things, change some styling and that's it.
About the latter one, my personal opinion, don't use it for your own developing. It creates a big mess later. Keep your structure modular with _module.less
for every module you want to customize and you will get a better outcome & maintainable project at the end.
add a comment |
Simple explanation or difference between both:
_extend.less
is the way to extend/modify parent themes styles for example you're happy with your parent theme Luma and just want to change the button styles in your custom theme, all you need to do is create a new file _buttons_extend.less
under web/css/source
in your custom theme and adjust styles in there. Register this file by adding it to the _extend.less
file inside your theme directory.
What if you want to extend styles of a module e.g. checkout module, well you can create an _extend.less
file inside your themes module folder e.g. Magento_Checkout/web/css/source/_extend.less
and add/extend module styling in there.
Now if I added _module.less
file inside my module directory Magento_Checkout/web/css/source/_module.less
I'm intending to override my parent themes styling for this module in which case I need to copy '_module.less
' file from my parent theme's module directory and make modification to that file in which case this file will replace parent themes _module.less
file altogether.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f116248%2fdifference-between-module-less-and-extend-less%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The answer is somewhat hidden in the Magento docs:
Extending a theme using _extend.less is the simplest option when you are happy with everything the parent theme has, but want to add more styles.
Read more here
Use _module.less when you want to make major changes in styles for a module and use _extend.less for minor adjustments. You'll find more examples on how to override component styles in the link above.
1
I've read that but it doesn't really explain why, it sounds like there's no reasoning behind it. I'm trying to figure out if there's any difference. I've been using _extend.less for all my changes as I prefer consistency to using something because 'Magento said so'.
– Ben Crook
May 23 '16 at 6:41
1
@BenCrook if my reading these past few days serves me right, no. If someone were to add any.less
file in their theme with the same path as a file in the parent theme/module, that is an override. You could probably verify by creating a blank _module.less into your theme, and seeing if the original styles apply.
– Darren Felton
Dec 14 '16 at 14:20
1
After aphp bin/magento setup:static-content:deploy
, you can look intopub/static/frontend/<vendor>/<themeName>/<locale>/css/
andpub/static/frontend/<vendor>/<themeName>/<locale>/<Module_Name>/css/
and there will be symbolic links for *.less files to either your theme, or the module/parent theme it is coming from.
– Darren Felton
Dec 14 '16 at 14:23
1
That is correct _module.less overrides the parent less file, there is no inheritance or merging. I realise I could have made that more clear in my original answer :)
– c.norin
Dec 15 '16 at 12:24
1
@MattCosentino I realise this reply comes very late, but I'll leave this here in case someone stumbles upon it: Please note the difference between _extends.less and _extend.less. The _extend.less files can be added to any module context, to extend styles from a parent theme. The _extends.less is located in the root of the theme and is used to extend existing utilities (refer to <project>/lib/web/css/docs/source/_utilities.less).
– c.norin
Jan 15 '18 at 17:01
|
show 3 more comments
The answer is somewhat hidden in the Magento docs:
Extending a theme using _extend.less is the simplest option when you are happy with everything the parent theme has, but want to add more styles.
Read more here
Use _module.less when you want to make major changes in styles for a module and use _extend.less for minor adjustments. You'll find more examples on how to override component styles in the link above.
1
I've read that but it doesn't really explain why, it sounds like there's no reasoning behind it. I'm trying to figure out if there's any difference. I've been using _extend.less for all my changes as I prefer consistency to using something because 'Magento said so'.
– Ben Crook
May 23 '16 at 6:41
1
@BenCrook if my reading these past few days serves me right, no. If someone were to add any.less
file in their theme with the same path as a file in the parent theme/module, that is an override. You could probably verify by creating a blank _module.less into your theme, and seeing if the original styles apply.
– Darren Felton
Dec 14 '16 at 14:20
1
After aphp bin/magento setup:static-content:deploy
, you can look intopub/static/frontend/<vendor>/<themeName>/<locale>/css/
andpub/static/frontend/<vendor>/<themeName>/<locale>/<Module_Name>/css/
and there will be symbolic links for *.less files to either your theme, or the module/parent theme it is coming from.
– Darren Felton
Dec 14 '16 at 14:23
1
That is correct _module.less overrides the parent less file, there is no inheritance or merging. I realise I could have made that more clear in my original answer :)
– c.norin
Dec 15 '16 at 12:24
1
@MattCosentino I realise this reply comes very late, but I'll leave this here in case someone stumbles upon it: Please note the difference between _extends.less and _extend.less. The _extend.less files can be added to any module context, to extend styles from a parent theme. The _extends.less is located in the root of the theme and is used to extend existing utilities (refer to <project>/lib/web/css/docs/source/_utilities.less).
– c.norin
Jan 15 '18 at 17:01
|
show 3 more comments
The answer is somewhat hidden in the Magento docs:
Extending a theme using _extend.less is the simplest option when you are happy with everything the parent theme has, but want to add more styles.
Read more here
Use _module.less when you want to make major changes in styles for a module and use _extend.less for minor adjustments. You'll find more examples on how to override component styles in the link above.
The answer is somewhat hidden in the Magento docs:
Extending a theme using _extend.less is the simplest option when you are happy with everything the parent theme has, but want to add more styles.
Read more here
Use _module.less when you want to make major changes in styles for a module and use _extend.less for minor adjustments. You'll find more examples on how to override component styles in the link above.
edited Jan 10 '18 at 21:21
Rafael Corrêa Gomes
4,77523366
4,77523366
answered May 22 '16 at 13:54
c.norinc.norin
32727
32727
1
I've read that but it doesn't really explain why, it sounds like there's no reasoning behind it. I'm trying to figure out if there's any difference. I've been using _extend.less for all my changes as I prefer consistency to using something because 'Magento said so'.
– Ben Crook
May 23 '16 at 6:41
1
@BenCrook if my reading these past few days serves me right, no. If someone were to add any.less
file in their theme with the same path as a file in the parent theme/module, that is an override. You could probably verify by creating a blank _module.less into your theme, and seeing if the original styles apply.
– Darren Felton
Dec 14 '16 at 14:20
1
After aphp bin/magento setup:static-content:deploy
, you can look intopub/static/frontend/<vendor>/<themeName>/<locale>/css/
andpub/static/frontend/<vendor>/<themeName>/<locale>/<Module_Name>/css/
and there will be symbolic links for *.less files to either your theme, or the module/parent theme it is coming from.
– Darren Felton
Dec 14 '16 at 14:23
1
That is correct _module.less overrides the parent less file, there is no inheritance or merging. I realise I could have made that more clear in my original answer :)
– c.norin
Dec 15 '16 at 12:24
1
@MattCosentino I realise this reply comes very late, but I'll leave this here in case someone stumbles upon it: Please note the difference between _extends.less and _extend.less. The _extend.less files can be added to any module context, to extend styles from a parent theme. The _extends.less is located in the root of the theme and is used to extend existing utilities (refer to <project>/lib/web/css/docs/source/_utilities.less).
– c.norin
Jan 15 '18 at 17:01
|
show 3 more comments
1
I've read that but it doesn't really explain why, it sounds like there's no reasoning behind it. I'm trying to figure out if there's any difference. I've been using _extend.less for all my changes as I prefer consistency to using something because 'Magento said so'.
– Ben Crook
May 23 '16 at 6:41
1
@BenCrook if my reading these past few days serves me right, no. If someone were to add any.less
file in their theme with the same path as a file in the parent theme/module, that is an override. You could probably verify by creating a blank _module.less into your theme, and seeing if the original styles apply.
– Darren Felton
Dec 14 '16 at 14:20
1
After aphp bin/magento setup:static-content:deploy
, you can look intopub/static/frontend/<vendor>/<themeName>/<locale>/css/
andpub/static/frontend/<vendor>/<themeName>/<locale>/<Module_Name>/css/
and there will be symbolic links for *.less files to either your theme, or the module/parent theme it is coming from.
– Darren Felton
Dec 14 '16 at 14:23
1
That is correct _module.less overrides the parent less file, there is no inheritance or merging. I realise I could have made that more clear in my original answer :)
– c.norin
Dec 15 '16 at 12:24
1
@MattCosentino I realise this reply comes very late, but I'll leave this here in case someone stumbles upon it: Please note the difference between _extends.less and _extend.less. The _extend.less files can be added to any module context, to extend styles from a parent theme. The _extends.less is located in the root of the theme and is used to extend existing utilities (refer to <project>/lib/web/css/docs/source/_utilities.less).
– c.norin
Jan 15 '18 at 17:01
1
1
I've read that but it doesn't really explain why, it sounds like there's no reasoning behind it. I'm trying to figure out if there's any difference. I've been using _extend.less for all my changes as I prefer consistency to using something because 'Magento said so'.
– Ben Crook
May 23 '16 at 6:41
I've read that but it doesn't really explain why, it sounds like there's no reasoning behind it. I'm trying to figure out if there's any difference. I've been using _extend.less for all my changes as I prefer consistency to using something because 'Magento said so'.
– Ben Crook
May 23 '16 at 6:41
1
1
@BenCrook if my reading these past few days serves me right, no. If someone were to add any
.less
file in their theme with the same path as a file in the parent theme/module, that is an override. You could probably verify by creating a blank _module.less into your theme, and seeing if the original styles apply.– Darren Felton
Dec 14 '16 at 14:20
@BenCrook if my reading these past few days serves me right, no. If someone were to add any
.less
file in their theme with the same path as a file in the parent theme/module, that is an override. You could probably verify by creating a blank _module.less into your theme, and seeing if the original styles apply.– Darren Felton
Dec 14 '16 at 14:20
1
1
After a
php bin/magento setup:static-content:deploy
, you can look into pub/static/frontend/<vendor>/<themeName>/<locale>/css/
and pub/static/frontend/<vendor>/<themeName>/<locale>/<Module_Name>/css/
and there will be symbolic links for *.less files to either your theme, or the module/parent theme it is coming from.– Darren Felton
Dec 14 '16 at 14:23
After a
php bin/magento setup:static-content:deploy
, you can look into pub/static/frontend/<vendor>/<themeName>/<locale>/css/
and pub/static/frontend/<vendor>/<themeName>/<locale>/<Module_Name>/css/
and there will be symbolic links for *.less files to either your theme, or the module/parent theme it is coming from.– Darren Felton
Dec 14 '16 at 14:23
1
1
That is correct _module.less overrides the parent less file, there is no inheritance or merging. I realise I could have made that more clear in my original answer :)
– c.norin
Dec 15 '16 at 12:24
That is correct _module.less overrides the parent less file, there is no inheritance or merging. I realise I could have made that more clear in my original answer :)
– c.norin
Dec 15 '16 at 12:24
1
1
@MattCosentino I realise this reply comes very late, but I'll leave this here in case someone stumbles upon it: Please note the difference between _extends.less and _extend.less. The _extend.less files can be added to any module context, to extend styles from a parent theme. The _extends.less is located in the root of the theme and is used to extend existing utilities (refer to <project>/lib/web/css/docs/source/_utilities.less).
– c.norin
Jan 15 '18 at 17:01
@MattCosentino I realise this reply comes very late, but I'll leave this here in case someone stumbles upon it: Please note the difference between _extends.less and _extend.less. The _extend.less files can be added to any module context, to extend styles from a parent theme. The _extends.less is located in the root of the theme and is used to extend existing utilities (refer to <project>/lib/web/css/docs/source/_utilities.less).
– c.norin
Jan 15 '18 at 17:01
|
show 3 more comments
The _extends.less
with an S at the end within the Blank Theme, is a file where they created all the classes that can be extended via LESS
later within the theme, without the need of creating new components or modular structure for style changes. -> For those who don't believe me: https://github.com/magento/magento2/blob/2.3-develop/app/design/frontend/Magento/blank/web/css/source/_extends.less check the file.
The _extend.less
without the S at the end, is for when you are 99% happy with what the parent theme has and you just need to change a couple of things, change some styling and that's it.
About the latter one, my personal opinion, don't use it for your own developing. It creates a big mess later. Keep your structure modular with _module.less
for every module you want to customize and you will get a better outcome & maintainable project at the end.
add a comment |
The _extends.less
with an S at the end within the Blank Theme, is a file where they created all the classes that can be extended via LESS
later within the theme, without the need of creating new components or modular structure for style changes. -> For those who don't believe me: https://github.com/magento/magento2/blob/2.3-develop/app/design/frontend/Magento/blank/web/css/source/_extends.less check the file.
The _extend.less
without the S at the end, is for when you are 99% happy with what the parent theme has and you just need to change a couple of things, change some styling and that's it.
About the latter one, my personal opinion, don't use it for your own developing. It creates a big mess later. Keep your structure modular with _module.less
for every module you want to customize and you will get a better outcome & maintainable project at the end.
add a comment |
The _extends.less
with an S at the end within the Blank Theme, is a file where they created all the classes that can be extended via LESS
later within the theme, without the need of creating new components or modular structure for style changes. -> For those who don't believe me: https://github.com/magento/magento2/blob/2.3-develop/app/design/frontend/Magento/blank/web/css/source/_extends.less check the file.
The _extend.less
without the S at the end, is for when you are 99% happy with what the parent theme has and you just need to change a couple of things, change some styling and that's it.
About the latter one, my personal opinion, don't use it for your own developing. It creates a big mess later. Keep your structure modular with _module.less
for every module you want to customize and you will get a better outcome & maintainable project at the end.
The _extends.less
with an S at the end within the Blank Theme, is a file where they created all the classes that can be extended via LESS
later within the theme, without the need of creating new components or modular structure for style changes. -> For those who don't believe me: https://github.com/magento/magento2/blob/2.3-develop/app/design/frontend/Magento/blank/web/css/source/_extends.less check the file.
The _extend.less
without the S at the end, is for when you are 99% happy with what the parent theme has and you just need to change a couple of things, change some styling and that's it.
About the latter one, my personal opinion, don't use it for your own developing. It creates a big mess later. Keep your structure modular with _module.less
for every module you want to customize and you will get a better outcome & maintainable project at the end.
edited May 2 at 21:19
answered Mar 6 at 2:04
Ezequiel AlbaEzequiel Alba
1169
1169
add a comment |
add a comment |
Simple explanation or difference between both:
_extend.less
is the way to extend/modify parent themes styles for example you're happy with your parent theme Luma and just want to change the button styles in your custom theme, all you need to do is create a new file _buttons_extend.less
under web/css/source
in your custom theme and adjust styles in there. Register this file by adding it to the _extend.less
file inside your theme directory.
What if you want to extend styles of a module e.g. checkout module, well you can create an _extend.less
file inside your themes module folder e.g. Magento_Checkout/web/css/source/_extend.less
and add/extend module styling in there.
Now if I added _module.less
file inside my module directory Magento_Checkout/web/css/source/_module.less
I'm intending to override my parent themes styling for this module in which case I need to copy '_module.less
' file from my parent theme's module directory and make modification to that file in which case this file will replace parent themes _module.less
file altogether.
add a comment |
Simple explanation or difference between both:
_extend.less
is the way to extend/modify parent themes styles for example you're happy with your parent theme Luma and just want to change the button styles in your custom theme, all you need to do is create a new file _buttons_extend.less
under web/css/source
in your custom theme and adjust styles in there. Register this file by adding it to the _extend.less
file inside your theme directory.
What if you want to extend styles of a module e.g. checkout module, well you can create an _extend.less
file inside your themes module folder e.g. Magento_Checkout/web/css/source/_extend.less
and add/extend module styling in there.
Now if I added _module.less
file inside my module directory Magento_Checkout/web/css/source/_module.less
I'm intending to override my parent themes styling for this module in which case I need to copy '_module.less
' file from my parent theme's module directory and make modification to that file in which case this file will replace parent themes _module.less
file altogether.
add a comment |
Simple explanation or difference between both:
_extend.less
is the way to extend/modify parent themes styles for example you're happy with your parent theme Luma and just want to change the button styles in your custom theme, all you need to do is create a new file _buttons_extend.less
under web/css/source
in your custom theme and adjust styles in there. Register this file by adding it to the _extend.less
file inside your theme directory.
What if you want to extend styles of a module e.g. checkout module, well you can create an _extend.less
file inside your themes module folder e.g. Magento_Checkout/web/css/source/_extend.less
and add/extend module styling in there.
Now if I added _module.less
file inside my module directory Magento_Checkout/web/css/source/_module.less
I'm intending to override my parent themes styling for this module in which case I need to copy '_module.less
' file from my parent theme's module directory and make modification to that file in which case this file will replace parent themes _module.less
file altogether.
Simple explanation or difference between both:
_extend.less
is the way to extend/modify parent themes styles for example you're happy with your parent theme Luma and just want to change the button styles in your custom theme, all you need to do is create a new file _buttons_extend.less
under web/css/source
in your custom theme and adjust styles in there. Register this file by adding it to the _extend.less
file inside your theme directory.
What if you want to extend styles of a module e.g. checkout module, well you can create an _extend.less
file inside your themes module folder e.g. Magento_Checkout/web/css/source/_extend.less
and add/extend module styling in there.
Now if I added _module.less
file inside my module directory Magento_Checkout/web/css/source/_module.less
I'm intending to override my parent themes styling for this module in which case I need to copy '_module.less
' file from my parent theme's module directory and make modification to that file in which case this file will replace parent themes _module.less
file altogether.
answered May 2 at 22:25
DevtypeDevtype
2,25411333
2,25411333
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f116248%2fdifference-between-module-less-and-extend-less%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown