barbells
Version:
[//]: # ( ns__file unit: standard, comp: README.md )
18 lines (17 loc) • 871 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareHandlebars = void 0;
const registerPartials_1 = require("./registerPartials");
const registerHelpers_1 = require("./registerHelpers");
const createHandlebars_1 = require("./createHandlebars");
const fs = require('fs-extra');
async function prepareHandlebars(projectDir) {
if (!await fs.pathExists(projectDir))
throw new Error(`projectDir not found: ${projectDir}`);
const Handlebars = createHandlebars_1.createHandlebars();
// I used to have these in try statements, but I can't find a way to get them to throw an error
await registerPartials_1.registerPartials(`${projectDir}/partials`, Handlebars);
await registerHelpers_1.registerHelpers(`${projectDir}/helpers`, Handlebars);
return Handlebars;
}
exports.prepareHandlebars = prepareHandlebars;