RejectedSoftware Forums

Sign up

Convert diet template to HTML at runtime?

Is there a way to achieve this?

Re: Convert diet template to HTML at runtime?

On 1/31/20 10:23 AM, Carl Sturtivant wrote:

Is there a way to achieve this?

Not if the diet template has code in it (this can be interpolations of D
code as well).

But if it doesn't have code in it, yes... and no. Yes, it is possible,
but no I don't think there is a public interface for it. But It looks
like it's something that would be accepted:
https://github.com/rejectedsoftware/diet-ng/issues/16

Note, I have created a way to reprocess diet templates at runtime, as
long as the interpolations/code have not changed. I found this
tremendously useful, as it is a pain to recompile my entire project to
change a CSS class or write some javascript for the browser to deal
with. It's not 100% ready yet, but hopefully I can find the time to
finish it up: https://github.com/rejectedsoftware/diet-ng/pull/70

I'm actually using a very much modified diet-ng for my project that
saves me a ton of compile time and memory (not just the live mode). But
I need to find some time to get these change in working order and
commitable to diet-ng.

-Steve