Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Theming : enable Twig templatesĀ Debug

By editor , 27 April, 2016
Question

How to enable Twig templates Debug ? Debugging Twig templates.
Like drush vset theme_debug 1 On drupal 7 ?

Enable debugging

You enable Twig Debugging in sites/default/services.yml.
(If services.yml does not yet exist; copy default.services.yml and rename it to services.yml.)

parameters:
 twig.config:
  debug: true

Printing variables

{{ dump() }}
{{ dump(var) }}

Or If you have Devel's kint:

{{ kint() }}

 

Via Drush (On drupal 7, Not for D8)

drush vset theme_debug 1

 

Configuration override For theming and Integration.

To optimize performence, drupal compress and aggregate CSS / JS files. But for front side development we need to disable this function. You can do that from /admin/config/development/performance , and also via setting.php.

Disable CSS / JS preprocess by settings.php

$config['system.performance']['css']['preprocess'] = 0;
$config['system.performance']['js']['preprocess'] = 0;

Tags

  • Drupal 8
  • Theming
  • Twig

Comments

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer