dgp1130 / rules_prerender

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

`prerender_resources()` #28

Closed dgp1130 closed 3 years ago

dgp1130 commented 3 years ago

For users who generate binary or non-HTML content, prerender_multi_page() is a bit heavyweight. For starters, it has "page" in the name, implying its intended usage for HTML pages. It also extracts annotations, builds entry points, and exports scripts and styles. If you are just generating images, none of this infrastructure is useful. fortunately Bazel is smart enough to not execute those tools if users don't depend on them, however it is still excess infrastructure, clutters the dependency graph, and generally obfuscates the actual build.

As an alternative for such use cases, I'm thinking of prerender_raw_resources(), which is effectively a direct invocation of the renderer tool. It will invoke user code to generate a directory and stop there. No annotations are extracted, no entry points generated, no scripts or styles exported. This would enable users to leverage the renderer independently of other rules_prerender infrastructure. It would also be most useful for cases where extract_single_resources() is used, since it would likely be extracting from an unbundled directory where none of the other outputs of prerender_multi_page() are useful.

dgp1130 commented 3 years ago

Added a new macro prerender_resources() which fulfills this use case.

dgp1130 commented 2 years ago

Ref https://github.com/bazelbuild/bazel/issues/4092#issuecomment-869091443.