It works great! Thanks a lot!

I even wrote me a little wrapper for the common case and for utf-8 encoding (just posting it here, because maybe someone else finds it useful):

/**

  • this template assumes a HttpServerResponse object named res to be available in the current context.
  • Before writting the template file, it sets the content type to text/html and the encoding to utf-8
  • Params:
  • file = The file to render
  • setContent = Whether or not the 'Content-Type' should be set.
    */
    template renderDietFile(string file, bool setContent=true) {
    enum buf=compileDietFileMixin!(file, "res.bodyWriter");
    static if(setContent) {
    enum renderDietFile="res.headers[\"Content-Type\"]=\"text/html; charset=utf-8\";"~buf;
    

    }
    else {

    enum renderDietFile=buf;
    

    }
    }

-> It is a joy :-)