twig-renderer

1.0.7 • Public • Published

twig-renderer

This package provides the possibility to convert twig template to HTML. A special feature is the integration of Puppeteer, so that via this package can also be converted directly into PDF. Currently only the DIN A4 format is supported.

Conversion to HTML

const TwigRenderer = require("twig-renderer");

const twigRenderer = new TwigRenderer();
        
const html = await twigRenderer
    .render("./path/to/template", { a: 1, b: 2, c: "Any other data!"})
    .then(result => result.toHtml());

Conversion to PDF-Buffer

const TwigRenderer = require("twig-renderer");

const twigRenderer = new TwigRenderer();

const pdfBuffer = await twigRenderer
    .render("./path/to/template", { a: 1, b: 2, c: "Any other data!"})
    .then(result => result.toPdf());

Package Sidebar

Install

npm i twig-renderer

Weekly Downloads

0

Version

1.0.7

License

ISC

Unpacked Size

4.84 kB

Total Files

4

Last publish

Collaborators

  • grongworks