Drupal 8 : disable cache and enable twig debug
For theming your site it is best practice to disable the Drupal 8 cache since you are forced to clear all the caches on every change you make. The cache for Drupal is default turned on.
To do so, first of all copy the file example.settings.local.php from the folder /sites into the folder /sites/default and rename it to settings.local.php Search for this line :
# $settings['cache']['bins']['render'] = 'cache.backend.null'; and remove the comment setting # This will turn off the caching so don't copy this file to productionsites ! Now, depending on which modules you use, you can get an error on reloading your site. In that case use yoursite.com/rebuild.php Also, currently Display Suite 8.x.2.3 is giving an error (https://www.drupal.org/node/2655046)
Enable Twig debug
To make Twig easier to debug use the developer.services.yml (do not change the default.services.yml, it won't work) and place the following code in the file :
parameters: twig.config: debug: true auto-reload: true cache: false Put the file back to the server on /sites Reload the page and check the source code. In the source code you can now see extra comments telling you which templates are used. Also you find the suggestions for new templates like in theme key
<\!-- THEME HOOK: 'page' --> <\!-- FILE NAME SUGGESTIONS: * page--front.html.twig * page--.html.twig x page.html.twig --> <\!-- BEGIN OUTPUT from 'core/themes/stable/templates/layout/page.html.twig' --> For more info on debugging twig look at https://drupalize.me/blog/201405/lets-debug-twig-drupal-8