Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache views in the same subdirectory as their template #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion source/diet/html.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import diet.input;
import diet.parser;
import diet.traits;

import std.path : dirName, baseName, buildPath;


/** Compiles a Diet template file that is available as a string import.

Expand Down Expand Up @@ -51,7 +53,7 @@ template compileHTMLDietFile(string filename, ALIASES...)
}

enum _diet_hash = computeTemplateHash();
enum _diet_cache_file_name = "_cached_"~filename~"_"~_diet_hash.to!string~".d";
enum _diet_cache_file_name = buildPath(dirName(filename), "_cached_"~baseName(filename)~"_"~_diet_hash.to!string~".d");

static if (_diet_use_cache && is(typeof(import(_diet_cache_file_name)))) {
pragma(msg, "Using cached Diet HTML template "~filename~"...");
Expand Down