美文网首页drupal
Twig debug不工作 && 使用twig不存储cache

Twig debug不工作 && 使用twig不存储cache

作者: AnnaJIAN | 来源:发表于2019-07-10 13:18 被阅读0次

    settings.php

    if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
       include $app_root . '/' . $site_path . '/settings.local.php';
    }
    

    settings.local.php

    ini_set('memory_limit', '2048M');
    /**
     * Enable local development services.
     */
    $settings['container_yamls'][] = DRUPAL_ROOT . '/sites/services.local.yml';
    
    //twig 不存cache,方便debug,services.local.yml需要引入cache.backend.null
    $settings['cache']['bins']['render'] = 'cache.backend.null';
    $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
    
    $settings['system.performance']['css']['preprocess'] = FALSE;
    $settings['system.performance']['js']['preprocess'] = FALSE;
    

    services.local.yml

    parameters:
      session.storage.options:
        gc_probability: 1
        gc_divisor: 100
        gc_maxlifetime: 200000
        cookie_lifetime: 2000000
      twig.config:
        debug: true
        auto_reload: true
        cache: false
      renderer.config:
        required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
        auto_placeholder_conditions:
          max-age: 0
          contexts: ['session', 'user']
          tags: []
      factory.keyvalue:
        {}
      factory.keyvalue.expirable:
        {}
      filter_protocols:
        - http
        - https
        - ftp
        - news
        - nntp
        - tel
        - telnet
        - mailto
        - irc
        - ssh
        - sftp
        - webcal
        - rtsp
      cors.config:
        enabled: false
        allowedHeaders: []
        allowedMethods: []
        allowedOrigins: ['*']
        exposedHeaders: false
        maxAge: false
        supportsCredentials: false   
      http.response.debug_cacheability_headers: false
    services:
      cache.backend.null:
        class: Drupal\Core\Cache\NullBackendFactory
    

    相关文章

      网友评论

        本文标题:Twig debug不工作 && 使用twig不存储cache

        本文链接:https://www.haomeiwen.com/subject/zwackctx.html