diff --git a/lib/src/unit/ViewEngine.ts b/lib/src/unit/ViewEngine.ts index d6dc6bd..81d4ae5 100644 --- a/lib/src/unit/ViewEngine.ts +++ b/lib/src/unit/ViewEngine.ts @@ -95,7 +95,15 @@ export default class ViewEngine extends LifecycleUnit { */ public template_path(...parts: string[]): string { if ( !this.template_dir ) throw new MissingTemplateDirectoryError() - return path.resolve(this.template_dir, ...parts) + let template_dir = this.template_dir + if ( template_dir.startsWith('file://') ) template_dir = template_dir.slice(7) + + const resolved_path = path.resolve(template_dir, ...parts) + if ( resolved_path.startsWith('/') ) { + return `file://${resolved_path}` + } else { + return resolved_path + } } /**