@@ -30,16 +30,10 @@ export class Engine implements Types.ViewEngine {
3030 * @description Loads template and produces final HTML
3131 * @param templatePath - Relative template path
3232 * @param data - Template scope data
33- * @param options - Render options override values
3433 * @returns Rendered HTML string
3534 * @throws {Error } When template path not discovered
3635 */
37- async render (
38- templatePath : string ,
39- data : Record < string , unknown > = { } ,
40- options ?: Types . EngineRenderOptions
41- ) : Promise < string > {
42- const viewsDir = options ?. viewsDir ?? this . defaultViewsDir
36+ async render ( templatePath : string , data : Record < string , unknown > = { } ) : Promise < string > {
4337 if ( this . discoveredPaths === null ) {
4438 this . discoveredPaths = await Rendering . Discover . discoverPaths ( this . defaultViewsDir )
4539 }
@@ -51,9 +45,9 @@ export class Engine implements Types.ViewEngine {
5145 if ( ! discoveredTemplatePaths . has ( pathWithExt ) ) {
5246 throw new Error ( `Template not found: ${ templatePath } .` )
5347 }
54- const absPath = EngineParts . Utils . join ( viewsDir , pathWithExt )
48+ const absPath = EngineParts . Utils . join ( this . defaultViewsDir , pathWithExt )
5549 const compiled = await this . compileTemplate ( absPath )
56- return await this . renderNodes ( compiled . ast , data , viewsDir )
50+ return await this . renderNodes ( compiled . ast , data , this . defaultViewsDir )
5751 }
5852
5953 /**
@@ -118,7 +112,7 @@ export class Engine implements Types.ViewEngine {
118112 continue
119113 }
120114 if ( node . type === 'include' ) {
121- outputHtml += await this . render ( node . templatePath , data , { viewsDir } )
115+ outputHtml += await this . render ( node . templatePath , data )
122116 continue
123117 }
124118 if ( node . type === 'if' ) {
0 commit comments