UNPKG

@athenna/view

Version:

The Athenna template engine. Built on top of Edge.js.

27 lines (26 loc) 1.05 kB
/** * @athenna/view * * (c) João Lenon <lenon@athenna.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { Config } from '@athenna/config'; import { ViewImpl } from '#src/views/ViewImpl'; import { ServiceProvider } from '@athenna/ioc'; export class ViewProvider extends ServiceProvider { register() { const view = new ViewImpl(); this.container.instance('Athenna/Core/View', view); if (Config.exists('view.disk')) { view.createViewDisk(Config.get('view.disk')); } const disks = Config.get('view.namedDisks', {}); Object.keys(disks).forEach(k => view.createViewDisk(k, disks[k])); const properties = Config.get('view.properties', {}); Object.keys(properties).forEach(k => view.addProperty(k, properties[k])); const components = Config.get('view.components', {}); Object.keys(components).forEach(k => view.createComponentByPath(k, components[k])); } }