You are not logged in.
demo:ex\mvc-blog
When this DEMO is running, it can detect changes to the template *. html and update it. However, when the changes in the *. partial file cannot detect disease updates. So how to check and update the *. partial file when it is updated by other apps?
Last edited by suoke (2023-02-21 12:39:36)
Offline
Partials changes are not tracked, so you can try to force changes yourself (perhaps with FlushAnyCache) or change code for example I did this:
function TSynMustachePartials.GetPartial(const PartialName: RawUTF8): TSynMustache;
var
i: integer;
Temp: TSynMustache;
begin
if self=nil then begin
result := nil;
exit;
end;
i := fList.IndexOf(PartialName);
if i<0 then
result := nil
else begin
// Partial files by default in mORMot are loaded just once and then cached which is very bad
// during debugging when files are changed and it requires constant restart of the application.
// With this change we're disabling cache in debugMode.
// Note that internal partials (defined in template, not in external file) have to be loaded in a standard manner
Result := TSynMustache(fList.Objects[i]);
if DebugHook <> 0 then
begin
Temp := TSynMustache.Parse(AnyTextFileToRawUTF8(UTF8ToString(ViewsPath + PartialName + '.partial'), true));
if Temp.Template <> '' then
Result := Temp;
end;
end;
end;
Offline