On 2018-05-04 05:24, Michael Rynn wrote:

My problem is that I've already solved this one using PHP - Phalcon framework, which has template Views framework which generates PHP code. The generated code is used to render Hmtl content as a string, so that pages can be built from the cached HTML sections, usable by other templates.

From existing vibe.d examples, I have not seen an easy way to do this. All calls to render invoke the HttpResponse directly. Actually I'm not familiar enough with vibe.d details to know for sure if there isn't a simple way to do it.

Diet Templates are so clever, being compiled down to D code, but running them is a time penalty if the page construction requires stepping through the results of database query, and this loses any notions of having time saved by pre-compilation.

I want to easily cache the render result, save it in cached file folder and plug the cached result into the Http Server Response directly most of the time.

Have a look at this example [1]. It looks like that will write the HTML
result directly to a file.

[1]
https://github.com/rejectedsoftware/diet-ng/tree/master/examples/htmlgenerator

/Jacob Carlborg