debug view engine paths

This commit is contained in:
Garrett Mills 2020-09-05 10:29:30 -05:00
parent c8d9f80579
commit fa337864b4
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -94,11 +94,17 @@ export default class ViewEngine extends LifecycleUnit {
* @return string * @return string
*/ */
public template_path(...parts: string[]): string { public template_path(...parts: string[]): string {
console.log('template path parts', parts)
if ( !this.template_dir ) throw new MissingTemplateDirectoryError() if ( !this.template_dir ) throw new MissingTemplateDirectoryError()
let template_dir = this.template_dir let template_dir = this.template_dir
if ( template_dir.startsWith('file://') ) template_dir = template_dir.slice(7) if ( template_dir.startsWith('file://') ) template_dir = template_dir.slice(7)
console.log('template path dir', template_dir)
const resolved_path = path.resolve(template_dir, ...parts) const resolved_path = path.resolve(template_dir, ...parts)
console.log('template path resolved 1', resolved_path)
if ( resolved_path.startsWith('/') ) { if ( resolved_path.startsWith('/') ) {
return `file://${resolved_path}` return `file://${resolved_path}`
} else { } else {