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.cjs
CHANGED
|
@@ -5334,16 +5334,20 @@ var TemplateEngine = class {
|
|
|
5334
5334
|
static partialsLoaded = {};
|
|
5335
5335
|
static cssCache = {};
|
|
5336
5336
|
static registerPartials(templateDir) {
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5337
|
+
if (this.partialsLoaded[templateDir]) return;
|
|
5338
|
+
const registerFromDir = (dirPath) => {
|
|
5339
|
+
if (!fs3__default.default.existsSync(dirPath)) return;
|
|
5340
|
+
const files = fs3__default.default.readdirSync(dirPath);
|
|
5341
|
+
for (const file of files) {
|
|
5342
|
+
if (file.endsWith(".hbs")) {
|
|
5343
|
+
const name = path__default.default.basename(file, ".hbs");
|
|
5344
|
+
const content = fs3__default.default.readFileSync(path__default.default.join(dirPath, file), "utf-8");
|
|
5345
|
+
Handlebars__default.default.registerPartial(name, content);
|
|
5346
|
+
}
|
|
5345
5347
|
}
|
|
5346
|
-
}
|
|
5348
|
+
};
|
|
5349
|
+
registerFromDir(path__default.default.join(templateDir, "partials"));
|
|
5350
|
+
registerFromDir(path__default.default.join(templateDir, "layouts"));
|
|
5347
5351
|
this.partialsLoaded[templateDir] = true;
|
|
5348
5352
|
}
|
|
5349
5353
|
static loadAllCSS(stylesDir) {
|