Short Twig recipes for Drupalers

Short Twig recipes for Drupalers

So you hopped on the Drupal 8 bandwagon and know the general concepts of Twig. But a general documentation can't give answer to all the specific problems you face when you work on a concrete project.

Fear no more: here I am! The man who neither able to answer all your specific questions… ;) But the man who faced with his own Twig riddles too and found solutions here and there. Who will be glad to share the Twig recipes he collected with you. Eg.:

- How to add custom CSS classes to menu items based on menu name?
- How to add "bundle" CSS classes to nodes?
- How to add "bundle" CSS classes to fields?
- How to add "bundle" CSS classes to blocks?
- Why and how to use twig extends?
- How to display custom dates in a localize-able way?
- How to add "first" / "last" CSS classes and item count to lists?
- etc.