Skip to content

Commit ba46f1c

Browse files
committed
Formatting
1 parent b1fff03 commit ba46f1c

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, dirs, config) {
2020
super(name, dirs, config);
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) {
@@ -125,14 +125,14 @@ class Liquid extends TemplateEngine {
125125
this.liquidLib.registerTag(name, tagObj);
126126
}
127127

128-
addGlobals(globals){
128+
addGlobals(globals) {
129129
for (let [name, value] of Object.entries(globals)) {
130130
this.addGlobal(name, value);
131131
}
132132
}
133133

134-
addGlobal(name, value){
135-
this.globalsReference[name] = value
134+
addGlobal(name, value) {
135+
this.globalsReference[name] = value;
136136
}
137137

138138
addAllShortcodes(shortcodes) {

src/Engines/TemplateEngine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class TemplateEngine {
109109
return true;
110110
}
111111

112-
needsGlobals(){
112+
needsGlobals() {
113113
return false;
114114
}
115115

src/Template.js

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

373373
this._dataCache = mergedData;
374-
if(this.templateRender.engine.needsGlobals()){
375-
if(typeof this.templateRender.engine.addGlobals != 'function'){
376-
throw new Error("Internal error: the engine's `.needsGlobals()` method returned `true`, but it does not have an `.addGlobals()` method");
374+
if (this.templateRender.engine.needsGlobals()) {
375+
if (typeof this.templateRender.engine.addGlobals != "function") {
376+
throw new Error(
377+
"Internal error: the engine's `.needsGlobals()` method returned `true`, but it does not have an `.addGlobals()` method",
378+
);
377379
}
378-
this.templateRender.engine.addGlobals(globalData)
380+
this.templateRender.engine.addGlobals(globalData);
379381
}
380382
return mergedData;
381383
}

0 commit comments

Comments
 (0)