A idea to improve diet-ng compile speed!

workman workman at gmail.com
Thu Aug 12 14:11:25 UTC 2021


On Thursday, 12 August 2021 at 13:49:32 UTC, Steven Schveighoffer 
wrote:

> But changing the code means recompiling. And that is not always 
> easy, because diet templates are compiled with specific context 
> and aliases, which are not easy to replicate as a subpart of 
> the project. I have considered splitting my routes out into 
> individual subprojects to see if that helps with the build 
> times.


Mixed d code with views made vibe.d like old PHP code, it hard to 
maintain if business logic change fast, and not easy to testing.


I am consider use a javascript server side render template like



On Thursday, 12 August 2021 at 14:04:03 UTC, Steven Schveighoffer 
wrote:
> On 8/12/21 9:45 AM, workman wrote:
> From experience, I think the 2 hours is probably not because of 
> diet CTFE interpretation. But I could be wrong, I don't know 
> what your application is like.

Not really take hours, but very slow and require a lot memory.


> diet supports layout inheritance via the `extends` directive.
>
> e.g. all my files look like:
>
> ```pug
> extends layout
> block extraCss
>   // extra css includes
> block extraJs
>   // extra js includes
> block content
>   // page content
> ```


Thanks for the tips, I will try extends. What will be really nice 
is some thing like:

```twig
{% extends "base.html" %}

     {% block sidebar %}
         <h3>Table Of Contents</h3>
         ...
         {{ parent() }}
     {% endblock %}
     ```





More information about the Digitalmars-d mailing list