Skip to content

Commit a211033

Browse files
committed
Formatting
1 parent 336f98b commit a211033

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

src/Engines/Liquid.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Liquid extends TemplateEngine {
1919
constructor(name, eleventyConfig) {
2020
super(name, eleventyConfig);
2121

22-
this.globalsReference = this.config.globalData
22+
this.globalsReference = this.config.globalData;
2323
this.liquidOptions = this.config.liquidOptions || {};
2424

2525
this.setLibrary(this.config.libraryOverrides.liquid);
@@ -52,27 +52,27 @@ class Liquid extends TemplateEngine {
5252

5353
let options = Object.assign(defaults, this.liquidOptions || {});
5454

55-
this.mergeGlobalData()
56-
options.globals = this.globalsReference
55+
this.mergeGlobalData();
56+
options.globals = this.globalsReference;
5757
// debug("Liquid constructor options: %o", options);
5858

5959
return options;
6060
}
6161

62-
mergeGlobalData(){
63-
for(let name in this.config.liquidOptions.globals){
64-
if(name in this.config.globalData) continue;
65-
this.config.globalData[name] = this.config.liquidOptions.globals[name]
62+
mergeGlobalData() {
63+
for (let name in this.config.liquidOptions.globals) {
64+
if (name in this.config.globalData) continue;
65+
this.config.globalData[name] = this.config.liquidOptions.globals[name];
6666
}
6767
}
6868

6969
/**
7070
* Liquid needs to receive globals in order for {% render %} to have access to them
7171
*
7272
* @override
73-
**/
74-
needsGlobals(){
75-
return true
73+
**/
74+
needsGlobals() {
75+
return true;
7676
}
7777

7878
static wrapFilter(fn) {
@@ -131,14 +131,14 @@ class Liquid extends TemplateEngine {
131131
this.liquidLib.registerTag(name, tagObj);
132132
}
133133

134-
addGlobals(globals){
134+
addGlobals(globals) {
135135
for (let [name, value] of Object.entries(globals)) {
136136
this.addGlobal(name, value);
137137
}
138138
}
139139

140-
addGlobal(name, value){
141-
this.globalsReference[name] = value
140+
addGlobal(name, value) {
141+
this.globalsReference[name] = value;
142142
}
143143

144144
addAllShortcodes(shortcodes) {

src/Engines/TemplateEngine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class TemplateEngine {
115115
return true;
116116
}
117117

118-
needsGlobals(){
118+
needsGlobals() {
119119
return false;
120120
}
121121

src/Template.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,13 @@ class Template extends TemplateContent {
356356
debugDev("%o getData mergedData", this.inputPath);
357357

358358
this._dataCache = mergedData;
359-
if(this.templateRender.engine.needsGlobals()){
360-
if(typeof this.templateRender.engine.addGlobals != 'function'){
361-
throw new Error("Internal error: the engine's `.needsGlobals()` method returned `true`, but it does not have an `.addGlobals()` method");
359+
if (this.templateRender.engine.needsGlobals()) {
360+
if (typeof this.templateRender.engine.addGlobals != "function") {
361+
throw new Error(
362+
"Internal error: the engine's `.needsGlobals()` method returned `true`, but it does not have an `.addGlobals()` method",
363+
);
362364
}
363-
this.templateRender.engine.addGlobals(globalData)
365+
this.templateRender.engine.addGlobals(globalData);
364366
}
365367
return mergedData;
366368
}

0 commit comments

Comments
 (0)