Art of writing better twig files - Drupal 8 (Theming and Performance)


When it comes to Drupal 8 theming layer, there is a lot Drupal 8 offers. Few concepts that come to mind while thinking of Drupal 8 theme layer include Renderable Array, Cacheabilty, Cache Context, Cache Tags, Twig & Pre-processors. Some of these are improvements of old concepts, while others are new introduction in Drupal 8.

In this session, I'll share my experience on how to best utilise these concepts for a robust and performant frontend with Drupal 8.



  • Renderable array caching
    • Drupal 8 caching power
    • Cache contexts
  • Template files/preprocessor functions
    • Selection & Placement
  • Use of Drupal Attributes
  • Logic in template/twig files - Yes/No?