jandc / critical-css-silex
There is no license information available for the latest version (0.5) of this package.
0.5
2018-02-23 09:18 UTC
Requires
- jandc/critical-css: ^0.5
- jandc/twig-wrapper-provider: ^0.3
- silex/silex: ^1.2
This package is auto-updated.
Last update: 2026-02-21 00:54:47 UTC
README
Package, containing all the components to integrate generated automatic critical css into a silex 1.* project
Usage
Installation
composer require jandc/critical-css-silex
Registering the twig wrapper (with post processor) and twig extension
$app->register(new TwigWrapperProvider('twig', [new CriticalCssProcessor()])); $app->extend('twig', function (Twig_Environment $twig, $app) { $twig->addExtension(new CSSFromHTMLExtractor\Twig\Extension()); return $twig; });
Mark the regions of your templates with the provided blocks
{% fold %}
<div class="my-class">
...
</div>
{% endfold %}
Render your pages, using the twigwrapper
$app['twigwrapper']->render('@templates/my/template.twig', ['foo'=>'bar']);