Render templates using Twig PHP, via this Node JS renderer.
Special thanks to Salem Ghoweri for collaboration on this project!
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.
npm install
composer install
npm run setup