WP Starter Théme
Ctrlk
  • Getting Started
    • Pré-requis
    • Technos
    • Nouveau projet
    • Projet existant
    • Workflow
    • Réunion
  • System management
    • Structure des dossiers
    • Environment
    • Wordpress
    • Timber
    • Ecommerce !
  • Twig - Front
    • Layout et block
    • Les Images
    • Les Liens
    • Filters et Fonctions
  • CSS
    • CSS
  • JS
    • Stimulus
    • Des Tools Cool
  • SEO
    • Breadcump
  • Utility
    • Dev Tools
  • Mise en Prod
    • Déployement sur Plesk
    • Optimisation
    • Opti des images
  • WC : Woo Commerce
    • WC : découverte !
Powered by GitBook
On this page
  1. Mise en Prod

Optimisation

LogoFile concatenation and minification · WordPress VIP DocumentationWordPress VIP Documentation
https://wicg.github.io/element-timing/wicg.github.io
LogoPurgeCSS - Remove unused CSS | PurgeCSSpurgecss.com
PreviousDéployement sur PleskNextOpti des images

Last updated 10 months ago

<?php

use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
use Twig\Extra\Cache\CacheExtension;
use Twig\Extra\Cache\CacheRuntime;
use Twig\RuntimeLoader\RuntimeLoaderInterface;

add_filter('timber/twig', function ($twig) {
    $twig->addRuntimeLoader(new class implements RuntimeLoaderInterface
    {
        public function load($class)
        {
            if (CacheRuntime::class === $class) {
                return new CacheRuntime(new TagAwareAdapter(new FilesystemAdapter('', 0, TIMBER_LOC . '/cache/twig')));
            }
        }
    });
    $twig->addExtension(new CacheExtension());

    return $twig;
});

add_filter('timber/twig/environment/options', function ($options) {
    $options['cache'] = true;
    return $options;
});