| 38 | }; |
| 39 | |
| 40 | const registerPartials = (): void => { |
| 41 | if (!fs.existsSync(COMPONENTS_DIR)) { |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | const partialFiles = fs.readdirSync(COMPONENTS_DIR); |
| 46 | |
| 47 | for (const file of partialFiles) { |
| 48 | if (file.endsWith(".hbs")) { |
| 49 | const partialName = path.basename(file, ".hbs"); |
| 50 | const partialContent = fs.readFileSync( |
| 51 | path.join(COMPONENTS_DIR, file), |
| 52 | "utf8" |
| 53 | ); |
| 54 | |
| 55 | Handlebars.registerPartial(partialName, partialContent); |
| 56 | } |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | const findTemplates = (dir: string, fileList: string[] = []): string[] => { |
| 61 | const files = fs.readdirSync(dir); |