2017 © Pedro Peláez
 

package page-specific-css-silex

image

jandc/page-specific-css-silex

  • Saturday, January 21, 2017
  • by jandc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 63 % Grown

The README.md

Critical CSS (silex package)

Package, containing all the components to integrate generated automatic critical css into a silex 1.* project, (*1)

Usage

Installation

composer require jandc/critical-css-silex, (*2)

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

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

```, (*4)

The Versions