superawesomelabs / leo

Highly Extensible, Declarative Static Site Generator
103 stars 6 forks source link

Scaffolding Plugins #148

Closed ChristopherBiscardi closed 7 years ago

ChristopherBiscardi commented 8 years ago

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.

TheLarkInn commented 8 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 commented 8 years ago

Tying https://github.com/mutualofomaha/multipage-webpack-plugin/issues/4

ChristopherBiscardi commented 8 years ago

@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.

TheLarkInn commented 8 years ago

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).

ChristopherBiscardi commented 8 years ago

Braindump on how to modularize LEO to make it easier to integrate multipage-plugin and introduce scaffolding plugins.

LEO Core Components

How can we modularize them?


Currently there are a couple files that are user-overridable:

We will add the following for "advanced" use cases which include scaffolding plugins.

ChristopherBiscardi commented 8 years ago

@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.

ChristopherBiscardi commented 8 years ago

Scaffolding plugins work. Doing a Preact POC next.

ChristopherBiscardi commented 7 years ago

Scaffolding Plugins are merged into master (although are not in an npm release yet).