Closed ChristopherBiscardi closed 7 years ago
Commenting per twitter. Maybe or maybe not my teams multipage-webpack-plugin will help to satisfy some needs required for you.
One thing to note: This plugin is designed for multipage server routed apps (from Rails, Laravel, Springboot etc.). Technically this could still work for client routed apps as well (as long as those client routes are defined through System.import()
and webpack creates the dynamic chunks for them.
@TheLarkInn LEO is actually "server rendered" to generate the HTML files. Only difference is that the "server" is executed immediately inside a webpack plugin (mapped over a list of URLs when the bundle is emitted) rather than letting that execution happen on a Rails server, etc.
So presumably, multipage-plugin could be used to generate the entries for the client-side bundle and when it outputs some "server-renderable" objects LEO can pick those up and execute them immediately rather than letting a future server do it. This results in an "Isomorphic/Universal" static site.
Awesome. Then I definitely see a use case for you. Perhaps once we define our default and in-house scenarios, we can then start proposing your scenario (if the implemented options available do not suffice).
Braindump on how to modularize LEO to make it easier to integrate multipage-plugin and introduce scaffolding plugins.
Currently there are a couple files that are user-overridable:
routes.js
file and a fallback, which we might be able to come up with a better solution for?We will add the following for "advanced" use cases which include scaffolding plugins.
render()
function for the body content. The output of this function will be passed to the html wrapper as a string. The html template should handle injecting the necessary JSON for the client-side app to hydrate.@TheLarkInn
Perhaps once we define our default and in-house scenarios, we can then start proposing your scenario (if the implemented options available do not suffice).
Indeed. Let me know when it's useful for me to contribute that data. At the very least, I think I'll be able to take the knowledge from multipage-plugin's implementation and adjust it slightly to my needs since it is significantly more advanced than the current implementation in LEO.
Scaffolding plugins work. Doing a Preact POC next.
Scaffolding Plugins are merged into master (although are not in an npm release yet).
With user-defined entry points, The entire app can be based in any view library (preact, pux(purescript), etc) with the user's choice of routing library (react-router, etc) and more.
Maybe it's worth pulling entrypoint/html/routes.js presets into a separate library. Then we can have scaffolding plugins for preact, pux(purescript), etc that supply the necessary entry points and html wrappers, etc.