Skip to content

Commit

Permalink
Merge pull request #157 from christianllv/fix-options
Browse files Browse the repository at this point in the history
pass options to the engines from ecto
  • Loading branch information
jaredwray committed Feb 5, 2024
2 parents 5763f47 + 3de7581 commit 23cee1b
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/ecto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,25 @@ export class Ecto {
private __defaultEngine = 'ejs';

// Engines
private readonly __ejs: EJS = new EJS();
private readonly __markdown: Markdown = new Markdown();
private readonly __pug: Pug = new Pug();
private readonly __nunjucks: Nunjucks = new Nunjucks();
private readonly __handlebars: Handlebars = new Handlebars();
private readonly __liquid: Liquid = new Liquid();

constructor(options?: any) {
private readonly __ejs: EJS;
private readonly __markdown: Markdown;
private readonly __pug: Pug;
private readonly __nunjucks: Nunjucks;
private readonly __handlebars: Handlebars;
private readonly __liquid: Liquid;

constructor(options?: Record<string, unknown>) {
const engineOptions = {...options};
delete engineOptions.defaultEngine;

// Engines
this.__ejs = new EJS(engineOptions);
this.__markdown = new Markdown(engineOptions);
this.__pug = new Pug(engineOptions);
this.__nunjucks = new Nunjucks(engineOptions);
this.__handlebars = new Handlebars(engineOptions);
this.__liquid = new Liquid(engineOptions);

// Register engines
this.__engines.push(this.__ejs, this.__markdown, this.__pug, this.__nunjucks, this.__handlebars, this.__liquid);

Expand Down

0 comments on commit 23cee1b

Please sign in to comment.