import {join} from "path"; import * as TwigEngine from "twig"; import {Config, getConfig} from "../config"; export class Twig { private config: Config = getConfig(); public compile(src: string, context: any): string { const options: any = { data: src, namespaces: { 'patterns': join(this.config.src, 'components/'), 'components': join(this.config.src, 'patterns/'), } }; return TwigEngine.twig(options).render(context); } }