Answer the question
In order to leave comments, you need to log in
What is the correct file layout in magenta?
There are modules for your code in magento 2. There are themes for templates. If necessary, you can override both phtml and html, as well as js and css.
Possible options:
- create .phtml in your module and use it in blocks instead of standard templates;
- do not create anything in your module, but create .phtml in the theme for your module;
- in the theme, override the default .phtml with your own.
With js, something similar:
- create .js in your module and override the base one;
- create .js in your module and do not override the base one, but use it instead;
- create .js in the theme and override the base one;
- do not create anything in your module, but create .js for your module in the theme.
I hope the essence is clear: there are a lot of options and how to do it right is not clear. At least in some cases.
For example, I need to make my Magento_Checkout/js/view/shipping.js
. I already have Vendor_Checkout and have Vendor_Theme theme.
With modules, too, everything is not clear. At the beginning, I thought that for each section (like magento) you need to create your own modules (Checkout, etc.), but now I think that maybe the modules were conceived as portable code for different projects and nothing more? Is your code all in the subject? But still, sometimes you need the functionality of modules and it is clearly project-dependent.
In general, if you have a hand in such matters, then I invite you to share your opinion on this matter. Thank you!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question