- Start support for auto-generated routes using UniversalPath
All checks were successful
continuous-integration/drone/push Build is passing
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:
@@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user