UNPKG

1.61 kBSource Map (JSON)View Raw
1{"version":3,"file":"LayoutPlugin.js","sourceRoot":"","sources":["../../../../src/lib/output/plugins/LayoutPlugin.ts"],"names":[],"mappings":";;;;;;;;AAAA,8CAA6D;AAC7D,sCAAsC;AAStC,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,8BAAiB;IAI/C,UAAU;QACN,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,kBAAS,CAAC,GAAG,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC;IAOO,iBAAiB,CAAC,IAAe;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAM,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAE,CAAC,WAAW,EAAE,CAAC;QACzF,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACJ,CAAA;AAjBY,YAAY;IADxB,sBAAS,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC;GACf,YAAY,CAiBxB;AAjBY,oCAAY","sourcesContent":["import { Component, RendererComponent } from '../components';\nimport { PageEvent } from '../events';\n\n/**\n * A plugin that wraps the generated output with a layout template.\n *\n * Currently only a default layout is supported. The layout must be stored\n * as ´layouts/default.hbs´ in the theme directory.\n */\n@Component({name: 'layout'})\nexport class LayoutPlugin extends RendererComponent {\n /**\n * Create a new LayoutPlugin instance.\n */\n initialize() {\n this.listenTo(this.owner, PageEvent.END, this.onRendererEndPage);\n }\n\n /**\n * Triggered after a document has been rendered, just before it is written to disc.\n *\n * @param page An event object describing the current render operation.\n */\n private onRendererEndPage(page: PageEvent) {\n const layout = this.owner.theme!.resources.layouts.getResource('default')!.getTemplate();\n page.contents = layout(page);\n }\n}\n"]}
\No newline at end of file