- Start support for auto-generated routes using UniversalPath
All checks were successful
continuous-integration/drone/push Build is passing

- Start support for custom view engine props & functions
- Start login template and namespace
This commit is contained in:
2021-06-29 01:44:07 -05:00
parent faa8a31102
commit cf6d14abca
9 changed files with 172 additions and 14 deletions

View File

@@ -17,14 +17,20 @@ export class PugViewEngine extends ViewEngine {
public renderByName(templateName: string, locals: { [p: string]: any }): string | Promise<string> {
let compiled = this.compileCache[templateName]
if ( compiled ) {
return compiled(locals)
return compiled({
...this.getGlobals(),
...locals,
})
}
const filePath = this.resolveName(templateName)
compiled = pug.compileFile(filePath.toLocal, this.getOptions(templateName))
this.compileCache[templateName] = compiled
return compiled(locals)
return compiled({
...this.getGlobals(),
...locals,
})
}
/**
@@ -39,4 +45,8 @@ export class PugViewEngine extends ViewEngine {
globals: [],
}
}
getFileExtension(): string {
return '.pug'
}
}