shapecode/twig-collector-extension

Ability to collect html code.

1.3.1 2018-08-22 12:47 UTC

This package is auto-updated.

Last update: 2021-09-29 01:50:31 UTC


README

SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

Install instructions

Via Composer

$ composer require shapecode/twig-collector-extension

Add Extension to your Twig Environment

<?php 

use Twig\Environment;
use Shapecode\Twig\Extensions\Extension\CollectorExtension;

$twig = new Environment($loader);
$twig->addExtension(new CollectorExtension());

Usage

collect stuff over all templates

{% collector stylesheets %}
<style>
    .body {
        margin-bottom: 10px;
    }
</style>
{% endcollector %}

... and output it at a specific line

{% collection stylesheets %}