shapecode/twig-collector-extension

此包已被废弃且不再维护。未建议替代包。

能够收集HTML代码。

1.3.1 2018-08-22 12:47 UTC

This package is auto-updated.

Last update: 2023-12-03 12:19:44 UTC


README

SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

安装说明

通过Composer

$ composer require shapecode/twig-collector-extension

将扩展添加到您的Twig环境中

<?php 

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

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

用法

在所有模板中收集内容

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

...并在特定行输出它

{% collection stylesheets %}