PHP code example of jandc / critical-css-silex

1. Go to this page and download the library: Download jandc/critical-css-silex library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jandc / critical-css-silex example snippets


$app->register(new TwigWrapperProvider('twig', [new CriticalCssProcessor()]));

$app->extend('twig', function (Twig_Environment $twig, $app) {
    $twig->addExtension(new CSSFromHTMLExtractor\Twig\Extension());
    return $twig;
});


 $app['twigwrapper']->render('@templates/my/template.twig', ['foo'=>'bar']);