On Thu, 16 Feb 2017 14:42:36 GMT, Alexey Kulentsov wrote:

Some questions about diet templates placement:

Usually we have diet templates in views/ folder and they are found when we do include or extend in other diet template file, but not in string. I have foo.dt with content include bar, then do dst.compileHTMLDietFile("foo.dt") and it works as expected. Then I do dst.compileHTMLDietString("include bar") and it fails with 'Missing include input file'. 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. 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)

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.