1

First post on here, I've started developing a custom theme extending the blank theme and I'm just curious about making a module.

I've started on a module and I've made some blocks & templates, and it all works well, however I'm not sure if I've done everything right.

My module is 100% for the custom theme and nothing else, the module is in:

app/code/VendorName_ModuleName

And I have my theme in:

app/design/frontend/VendorName_ModuleName

Is this correct? Or should I have my module inside my theme? So it'd be like:

app/design/frontend/VendorName_ModuleName/VendorName_ModuleName

I think I'm doing everything right so far, however I'm not sure. I've named the theme & the module the same names (as the module will just provide everything for the theme and nothing else, so I figured this works the best).

Thanks

0

Welcome!

Yeah what you've done is correct so far. For the styling:

Just think if someone else was to use your module, would they also want your styling?

If they would want your styling then also add that within app/code/VendorName_ModuleName. Otherwise it's better to NOT style the module within app/code and to style it within your theme.

  • Thank you! Okay great, I've done some styling in the module (just a layout.xml) however I've mostly done referenceContainers in there, which are defined in the themes XML. I'm assuming that's right? Thanks again. – Sledmore Oct 26 '16 at 1:43
  • It comes down to whether your change ALWAYS needs to be made, if it's an XML change that your module depends on that it'll need to be in the modules XML, if it's a change that only needs to affect your theme then the theme's XML is the best place. If you will never be shipping your module to another theme/third party then technically it doesn't matter if it's in the module or the theme. – Ben Crook Oct 26 '16 at 9:47

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.