Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By ajung on
Running Drupal 8.3.0 under Apache. I am currently working on tweaking an existing module (PHP code and TWIG templates).
auto_load is set to true and cache to false in both files as recommended however I do not see any impact. Changes to my templates are not being picked up automatically. I always have to "drush cr" for getting the updated version of my template
The services.yml is being picked up (an error in the Yaml file gives an error during cache-rebuild.
...anything else I am missing? Can it be that hard for getting a reasonable dev environment working?
-aj
sites/default/services.yml
...
debug: true
# Twig auto-reload:
#
# Automatically recompile Twig templates whenever the source code changes.
# If you don't provide a value for auto_reload, it will be determined
# based on the value of debug.
#
# Not recommended in production environments
# @default null
auto_reload:true
# Twig cache:
#
# By default, Twig templates will be compiled and stored in the filesystem
# to increase performance. Disabling the Twig cache will recompile the
# templates from source each time they are used. In most cases the
# auto_reload setting above should be enabled rather than disabling the
# Twig cache.
#
# Not recommended in production environments
# @default true
cache: null
Comments
Set your "Local development
Set your "Local development override configuration feature" in the example.settings.local.php
Then in your development.services.yml file
twig.config:
debug: true
auto_reload: true
cache: false
under the parameters key
Actually, I'm experiencing
Actually, I'm experiencing the same thing.
Turns out this is a bit more complicated in Drupal 8, but even following the detailed instructions here:
Disable Drupal 8 caching during development
https://www.drupal.org/node/2598914
I still have to clear the cache every time I edit my node.html.twig template