diatechnis/twig-single-file-components

Create Vue-like single components with Twig

dev-master 2018-11-17 15:28 UTC

This package is auto-updated.

Last update: 2025-03-06 10:59:39 UTC


README

Create Vue-like single components with Twig

Quickstart

$twig = new \TwigSingleFileComponents\Environment($twig_loader);

$rendered = $twig->render($template, $data);

This will create an extended version of the Twig environment. On instantiation, the environment will create script, style and template parsers.

On render, the parsers will look for the proper tags ({% script %}, {% style %}, {% template %}), and store the contents of those tags.