Skip to content

Commit

Permalink
Move config refs into TemplateEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Nov 30, 2018
1 parent cdffa8c commit 987159c
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/Engines/Ejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Ejs extends TemplateEngine {

this.ejsOptions = {};

this.config = config.getConfig();
this.setLibrary(this.config.libraryOverrides.ejs);
this.setEjsOptions(this.config.ejsOptions);
}
Expand Down
1 change: 0 additions & 1 deletion src/Engines/Haml.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Haml extends TemplateEngine {
constructor(name, inputDir) {
super(name, inputDir);

this.config = config.getConfig();
this.setLibrary(this.config.libraryOverrides.haml);
}

Expand Down
1 change: 0 additions & 1 deletion src/Engines/Handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Handlebars extends TemplateEngine {
constructor(name, inputDir) {
super(name, inputDir);

this.config = config.getConfig();
this.setLibrary(this.config.libraryOverrides.hbs);
}

Expand Down
1 change: 0 additions & 1 deletion src/Engines/Liquid.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class Liquid extends TemplateEngine {
constructor(name, inputDir) {
super(name, inputDir);

this.config = config.getConfig();
this.liquidOptions = {};

this.setLibrary(this.config.libraryOverrides.liquid);
Expand Down
1 change: 0 additions & 1 deletion src/Engines/Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Markdown extends TemplateEngine {

this.markdownOptions = {};

this.config = config.getConfig();
this.setLibrary(this.config.libraryOverrides.md);
}

Expand Down
1 change: 0 additions & 1 deletion src/Engines/Mustache.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Mustache extends TemplateEngine {
constructor(name, inputDir) {
super(name, inputDir);

this.config = config.getConfig();
this.setLibrary(this.config.libraryOverrides.mustache);
}

Expand Down
1 change: 0 additions & 1 deletion src/Engines/Nunjucks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Nunjucks extends TemplateEngine {
constructor(name, inputDir) {
super(name, inputDir);

this.config = config.getConfig();
this.setLibrary(this.config.libraryOverrides.njk);
}

Expand Down
1 change: 0 additions & 1 deletion src/Engines/Pug.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Pug extends TemplateEngine {
constructor(name, inputDir) {
super(name, inputDir);

this.config = config.getConfig();
this.pugOptions = {};

this.setLibrary(this.config.libraryOverrides.pug);
Expand Down
8 changes: 8 additions & 0 deletions src/Engines/TemplateEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fastglob = require("fast-glob");
const fs = require("fs-extra");
const TemplatePath = require("../TemplatePath");
const EleventyExtensionMap = require("../EleventyExtensionMap");
const config = require("../Config");
const debug = require("debug")("Eleventy:TemplateEngine");

class TemplateEngine {
Expand All @@ -16,6 +17,13 @@ class TemplateEngine {
this.engineLib = null;
}

get config() {
if (!this._config) {
this._config = config.getConfig();
}
return this._config;
}

getName() {
return this.name;
}
Expand Down

0 comments on commit 987159c

Please sign in to comment.