Via Composer
$ composer require shapecode/twig-collector-extensionAdd Extension to your Twig Environment
<?phpuseTwig\Environment;
useShapecode\Twig\Extensions\Extension\CollectorExtension;
$twig = newEnvironment($loader);
$twig->addExtension(newCollectorExtension());collect stuff over all templates
{% collectorstylesheets %}
<style>.body {margin-bottom: 10px; }</style>
{% endcollector %}... and output it at a specific line
{% collectionstylesheets %}