Skip to content

Commit b714fea

Browse files
committed
Some clean up
1 parent fb92e63 commit b714fea

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

packages/engine-nunjucks/lib/engine_nunjucks.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
'use strict';
2222

23-
var fs = require('fs-extra'),
23+
let fs = require('fs-extra'),
2424
path = require('path'),
2525
plPath = process.cwd(),
2626
plConfig = require(path.join(plPath, 'patternlab-config.json')),
@@ -32,11 +32,11 @@ var fs = require('fs-extra'),
3232
// LOAD ANY USER NUNJUCKS CONFIGURATIONS
3333
////////////////////////////
3434
try {
35-
var nunjucksConfig = require(path.join(
35+
let nunjucksConfig = require(path.join(
3636
plPath,
3737
'patternlab-nunjucks-config.js'
3838
));
39-
if (typeof nunjucksConfig == 'function') {
39+
if (typeof nunjucksConfig === 'function') {
4040
nunjucksConfig(nunjucks, env);
4141
}
4242
} catch (err) {}
@@ -53,15 +53,15 @@ if (!String.prototype.replaceAll) {
5353
str1.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g, '\\$&'),
5454
ignore ? 'gi' : 'g'
5555
),
56-
typeof str2 == 'string' ? str2.replace(/\$/g, '$$$$') : str2
56+
typeof str2 === 'string' ? str2.replace(/\$/g, '$$$$') : str2
5757
);
5858
};
5959
}
6060

6161
////////////////////////////
6262
// NUNJUCKS ENGINE
6363
////////////////////////////
64-
var engine_nunjucks = {
64+
let engine_nunjucks = {
6565
engine: nunjucks,
6666
engineName: 'nunjucks',
6767
engineFileExtension: '.njk',
@@ -79,7 +79,7 @@ var engine_nunjucks = {
7979
try {
8080
// replace pattern names with their full path so Nunjucks can find them.
8181
pattern.extendedTemplate = this.replacePartials(pattern);
82-
var result = nunjucks.renderString(pattern.extendedTemplate, data);
82+
let result = nunjucks.renderString(pattern.extendedTemplate, data);
8383
return Promise.resolve(result);
8484
} catch (err) {
8585
console.error('Failed to render pattern: ' + pattern.name);
@@ -88,14 +88,14 @@ var engine_nunjucks = {
8888

8989
// find and return any Nunjucks style includes/imports/extends within pattern
9090
findPartials: function findPartials(pattern) {
91-
var matches = pattern.template.match(this.findPartialsRE);
91+
let matches = pattern.template.match(this.findPartialsRE);
9292
return matches;
9393
},
9494

9595
// given a pattern, and a partial string, tease out the "pattern key" and return it.
9696
findPartial: function(partialString) {
9797
try {
98-
var partial = partialString.match(this.findPartialKeyRE)[1];
98+
let partial = partialString.match(this.findPartialKeyRE)[1];
9999
partial = partial.replace(/["']/g, '');
100100
return partial;
101101
} catch (err) {
@@ -118,13 +118,13 @@ var engine_nunjucks = {
118118

119119
replacePartials: function(pattern) {
120120
try {
121-
var partials = this.findPartials(pattern);
121+
let partials = this.findPartials(pattern);
122122
if (partials !== null) {
123-
for (var i = 0; i < partials.length; i++) {
123+
for (let i = 0; i < partials.length; i++) {
124124
// e.g. {% include "atoms-parent" %}
125-
var partialName = this.findPartial(partials[i]); // e.g. atoms-parent
126-
var partialFullPath = partialRegistry[partialName]; // e.g. 00-atoms/01-parent.njk
127-
var newPartial = partials[i].replaceAll(
125+
let partialName = this.findPartial(partials[i]); // e.g. atoms-parent
126+
let partialFullPath = partialRegistry[partialName]; // e.g. 00-atoms/01-parent.njk
127+
let newPartial = partials[i].replaceAll(
128128
partialName,
129129
partialFullPath,
130130
true
@@ -147,7 +147,7 @@ var engine_nunjucks = {
147147

148148
// still requires the mustache syntax because of the way PL handles lists
149149
findListItems: function(pattern) {
150-
var matches = pattern.template.match(this.findListItemsRE);
150+
let matches = pattern.template.match(this.findListItemsRE);
151151
return matches;
152152
},
153153

0 commit comments

Comments
 (0)