Closed jbmoelker closed 8 years ago
Should we include a piece about "modules within modules"? For example, if the object-media-viewer
in a project consists out of multiple submodules. I don't think that we want that. Should we make that explicit?
@petergoes in response to #issuecomment-186157722, personally I'd say stick to "Modules must be FIRST" and let a developer determine within a project if a nested structure is best. Of course a module should still only do one thing. But that one thing could be combining multiple modules for a single purpose. For example there may be a search-form, a search-filters and a radio-group. This could translate into:
modules/
radio-group/
radio-group.tag.html
search-filters/
search-filters.tag.html
search-form/
search-form.tag.html
But I can also imagine, search functionality being bundled. For instance if search-filters only really make sense inside of a search-form, a folder structure could be:
modules/
radio-group/
radio-group.tag.html
search-form/
search-form.tag.html
...
search-filters/
search-filters.tag.html
To me that is also "1 module = 1 directory". Larger projects may call for such a structure.
If you agree, the question is, should we document this or maybe add a demo repo in which this could be an example.
I tend to like the second option better. So that there can be multiple folders within folders. And I do think we should document that. Is there should be a demo repo, I don't think so. At least not for now. What should be made clear though is that when a submodule is generic enough to be also usable outside the 'parent' module, it should become a 'root-level' module.
@petergoes How about:
### How?
Use the module name as directory name and file basename.
The file extension depends on the purpose of the file.
modules/
my-example/
my-example.tag.html
my-example.less
...
README.md
If your project uses nested structures, you can nest a module within a module.
For example a generic `radio-group` module may be placed directly inside "modules/". While `search-filters` may only make sense inside a `search-form` and may therefore be nested:
modules/
radio-group/
radio-group.tag.html
search-form/
search-form.tag.html
...
search-filters/
search-filters.tag.html
I still think it's up to the team to decide whether to bundle modules or not. There could even be a core/
bundle module. radio-group
could be in that module if the team prefers. But a project's architecture must support it. A lot of frameworks do have similar concepts named "Areas", "Zones", "Blueprints" etc.
I wouldn't want to make the "1 module = 1 directory" rule too long. Do you think this covers it?
Yes, I think it does. I agree in that it is a team decision to use nested modules or not.
incl. summary, why, how. based on https://gist.github.com/jbmoelker/7f08d840c4d560c6c6c9#1-component--1-directory