UNPKG

include-me

Version:

[![Build Status](https://travis-ci.com/Emre-Kul/include-me.svg?branch=master)](https://travis-ci.com/Emre-Kul/include-me) ![](https://img.shields.io/github/license/Emre-Kul/include-me.svg)

29 lines 907 B
"use strict"; const page_controller_1 = require("./page-controller"); const template_engine_1 = require("./template-engine"); class App { constructor(rootFolderPath, fileSelector, includeRegex) { this.pageController = new page_controller_1.default(rootFolderPath); this.templateEngine = new template_engine_1.default(fileSelector, includeRegex); } load() { this.pageController.loadPagesFromFolder(); this.templateEngine.compile(this.pageController.getPages()); return this; } asArray() { return this.pageController.getPages(); } asObject(key = 'name') { const filesObj = {}; const files = this.pageController.getPages(); files.forEach((file) => { filesObj[file[key]] = file; }); return filesObj; } } module.exports = { IncludeMe: App, }; //# sourceMappingURL=index.js.map