Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292750

Make it easier for theme builders to enable Twig debugging and disable render cache

$
0
0

Problem/Motivation

(I'm not sure where to put this, component wise.)

Here is my go to configuration when theme building in Drupal:

Turn on Twig debug in sites/default/services.yml:

  twig.config:
    debug: true
    auto_reload: null
    cache: true

Disable page, dynamic_page, render cache so I get fresh data as I edit Twig templates:

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['page'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

Rebuild Drupal cache. Launch Laravel Mix with Browsersync, and go!

The problem is that this is fairly clunky and very backend orientated.

Proposed resolution

Find some way to easily enable faster theme debugging/building mode. Something that could read settings.php setting and tell the container to recompile and set the Twig parameter to debug and auto write the null cache backend.

I think it belongs in settings.php since it's easier to have local overrides there. Drupal doesn't have out-of-the-box local site service definitions.

Remaining tasks

Get DX feedback

User interface changes

API changes

Data model changes

Follow-up issues

#3278887: Update development.services.yml to include twig debug by default

Release notes snippet


Viewing all articles
Browse latest Browse all 292750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>