dgp1130 / rules_prerender

A Bazel rule set for prerending HTML pages.
13 stars 0 forks source link

Prerender with other languages #42

Open dgp1130 opened 2 years ago

dgp1130 commented 2 years ago

So far, rules_prerender makes heavy use of NodeJS to run JavaScript at build-time, however this is not a strict requirement. While most of the tooling takes advantage of NodeJS, there's no reason that needs to extend to user code. It makes just as much sense to allow users to write Rust, Java, Python, C#, or whatever other language they want to use (Haskell anyone?).

The only caveat here is that the renderer does require NodeJS, since it provides a cleaner interface to emit files at the right path with PrerenderResource. However, we could make an alternative renderer for any given language and provide a comparable API. As long as users specify in prerender_component() and/or prerender_pages() what language/framework they are using for prerendering and stay consistent within generating a single page, they can mostly use whatever they want.

We could also consider a slightly less opinionated version of prerender_pages() which allows the user to generate their own binary target but still get all the benefits of bundling. I'm not sure how much value all this gives, but I'm sure eventually someone will want to do this in Rust. It should be possible and we can track interest in this issue.