UNPKG

@zendesk/zcli-themes

Version:

zcli theme commands live here

16 lines (15 loc) 609 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const glob_1 = require("glob"); const fs = require("fs"); function getTemplates(themePath) { const templates = {}; const filenames = (0, glob_1.globSync)(`${themePath}/templates/**/*.hbs`.replace(/\\/g, '/'), { posix: true }); filenames.forEach((template) => { const identifier = template.replace(/\\/g, '/').split('templates/')[1].split('.hbs')[0]; const source = fs.readFileSync(template, 'utf8'); templates[identifier] = source; }); return templates; } exports.default = getTemplates;