While there are many methods to enable Twig Debug, this is one of the easiest and simple way

  • Step 1: Navigate to the \sites\default in the Drupal 8 dashboard.
  • Step 2: Now, start the process by making a copy of the default.services.yml file and renaming it to services.yml (if services.yml does not already exist).
  • Step 3: Next, open the file and search for this phrase 'twig.config'.
  • Step 4: Once you’ve got the phrase, set the debug mode to true, auto_reload mode to true and cache to false mode.
  • Step 5: Finally, go to the bottom of the file and copy the following code block as it is:
Parameters

twig.config:
debug: true

 

BY Best Interview Question ON 12 May 2020