jaelTemplatePreload function
Preload all of Jael templates into a cache
To apply additional transforms to parsed documents, provide a set of patch
functions.
Implementation
Future<void> jaelTemplatePreload(
Directory viewsDirectory, Map<String, Document> cache,
{String fileExtension = '.jael',
bool asDSX = false,
Iterable<Patcher> patch = const []}) async {
await viewsDirectory.list(recursive: true).forEach((f) async {
if (f.basename.endsWith(fileExtension)) {
var name = f.basename.split(".");
if (name.length > 1) {
//print("View: ${name[0]}");
Document? processed = await _loadViewTemplate(viewsDirectory, name[0]);
if (processed != null) {
cache[name[0]] = processed;
}
}
}
});
}