/
Twig

Twig

Drupal 8 is upon us and with it comes the Twigification of all theme output. Anything that was a PHP template or theme function in Drupal 7 is now a Twig template so we all need to level up on our Twiggy knowledge—and I'm not talking about this Twiggy or this Twiggy.

Syntax

Printing 

{{ someVar }}

Comments

{# This is a comment, yo. #} 

Control Structures

{% if var %} 
... 
{% endif %}
{% for user in users if user.active %} 
	{{ user.name }} : {{ user.email }} 
{% else %} 
	{# No active users #}
{% endfor %}

Documentation

From the creators: 


Drupal specific:

Tutorials:


Dev Setup

Related content

CSS/SASS philosophy
CSS/SASS philosophy
More like this
Comments | CSS + SCSS
Comments | CSS + SCSS
More like this
SCSS coding standards
SCSS coding standards
More like this
Core Block Customization Reference
Core Block Customization Reference
More like this
Coding Standards
Coding Standards
More like this
WordPress Training Videos
WordPress Training Videos
More like this