On Mon, 20 Feb 2017 19:42:03 GMT, Sönke Ludwig wrote:

... Is it possible to achieve the same interpretation as the contents of the file and the string argument? If no, how to modify template, passed to compileHTMLDietString(), to have it worked?

This is currently not directly possible, mostly because the file extension gets extracted from the root template file name.

Is this possible to make compileHTMLDietString() version with template file name passed as parameter? With FILE default value it will be reasonable I think.

However, as long as the list of possible include and base
template files is known, you should be able to achieve the same effect manually using compileHTMLDietStrings:

import diet.input, diet.html;
alias myCompileDietString(string contents, ALIASES...) =
    compileDietStrings!(Group!(
            "main.dt", contents,
            "layout.dt", import("layout.dt"),
            "bar.dt", import("bar.dt")
        ), ALIASES);

(disclaimer: not tested)

Ok! I will think about such approach but for first sight it seems to be overkill for my task. I am trying to implement component system and make each component to be encapsulated in one file (controller + template), but don't want to lost possibility to use diet features like extends and includes. If user can make one-file components, but have to manage this Group template, it does not make the situation easier.

Is this possible to change default views/ directory to another one?
Yes, you can use stringImportPaths "path1" "path2" ... in dub.sdl (or "stringImportPaths": ["path1", "path2", ...] in dub.json) to define the directories that get searched for Diet templates. If you define this, you'll also have to explicitly specify the "views" folder if you still want to use that.

Thanks! In the meantime, I also found this, but it takes the time. Now I can have 2-file components like editUser.d + editUser.dt.
P.S. Lack of documentation is very bad side of vibe.d. This prevents easy entry into the technology and make it less popular.