elseware-nodejs 1.7.3 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5319,16 +5319,20 @@ var TemplateEngine = class {
|
|
|
5319
5319
|
static partialsLoaded = {};
|
|
5320
5320
|
static cssCache = {};
|
|
5321
5321
|
static registerPartials(templateDir) {
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5322
|
+
if (this.partialsLoaded[templateDir]) return;
|
|
5323
|
+
const registerFromDir = (dirPath) => {
|
|
5324
|
+
if (!fs3.existsSync(dirPath)) return;
|
|
5325
|
+
const files = fs3.readdirSync(dirPath);
|
|
5326
|
+
for (const file of files) {
|
|
5327
|
+
if (file.endsWith(".hbs")) {
|
|
5328
|
+
const name = path.basename(file, ".hbs");
|
|
5329
|
+
const content = fs3.readFileSync(path.join(dirPath, file), "utf-8");
|
|
5330
|
+
Handlebars.registerPartial(name, content);
|
|
5331
|
+
}
|
|
5330
5332
|
}
|
|
5331
|
-
}
|
|
5333
|
+
};
|
|
5334
|
+
registerFromDir(path.join(templateDir, "partials"));
|
|
5335
|
+
registerFromDir(path.join(templateDir, "layouts"));
|
|
5332
5336
|
this.partialsLoaded[templateDir] = true;
|
|
5333
5337
|
}
|
|
5334
5338
|
static loadAllCSS(stylesDir) {
|