@basalt/twig-renderer

Render templates using Twig PHP, via this Node JS renderer.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
822Jun 9, 2021Jul 3, 2018Minified + gzip package size for @basalt/twig-renderer in KB

Readme

Twig Renderer

Greenkeeper badge

Render templates using Twig PHP, via this Node JS renderer.

Special thanks to Salem Ghoweri for collaboration on this project!

How to Use

npm install --save @basalt/twig-renderer
const TwigRenderer = require('@basalt/twig-renderer');

const config = { 
  // see `./config.schema.js` for details
};

const twigRenderer = new TwigRenderer(config);

twigRenderer.render('@components/card.twig', { title: 'hi' }).then(results => {
  if (results.ok) {
    console.log(results.html);
  } else {
    console.log(results.message);
  }
});

Looking in tests folder can help.

How to Develop

npm install
composer install
npm run setup

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.