Disapprove of this idea
The biggest disadvantage of this plugin is that it can't support multiple "content" directives.
Posthtml-modules is just another kind of include that can pass a "content" while including, it's some kind of inherit of one parent UI component, while posthtml-include is some kind of combination of UI components. As far as I see, the inherit idea destroys UI components' closure.
So I think that the posthtml-include plugin might be a better idea over posthtml-modules.
I don't have anything yet to bring to the table, but I really appreciate the idea and all the work done in posthtml.
I'm really glad that posthtml-modules exists because it solves usecases that cannot be done with posthtml-include. It's useful when your component is a wrapper to another component and don't want to care about the inner details. Layout components would be an example.
Just wanted to say again, thank you so much for your work!
While posthtml-modules's use is very much limited, in most case can be replaced by posthtml-include.
This plugin has an advantage over include plugin. I replaced include plugin with this one. Used the following settings to ease porting:
"posthtml-modules": {
"from": "src/view/.",
"tag": "include",
"attribute": "src",
"attributeAsLocals": true
}
Modular JavaScript is a good idea, for functionality reuse, but modular CSS and modular HTML may be not.
JavaScript code should be closure and abstract, but HTML and CSS should be open and specific.
Functionality can be easily shown or hidden, thus modular JavaScript makes things easier. But apperance can not be easily shown or hidden, thus modular HTML and modular CSS makes things harder.
For HTML and CSS, a simple "include" mechinism is good enough.