{{ _value.module }}

Simplified Twig template variables for Drupal

$ composer require 'drupal/value:1.x-dev'

{{ _article.field_image.url }}
instead of
{{ file_url(node.field_image.entity.uri.value) }}

            
$variables['_article'] = [
  'nid' => 1,
  'title' => 'Minus veritatis rem tenetur hic repellendus fugit.',
  'created' => 1538956800,
  'field_foo' => 'bar',
  'field_author' => [
    'uid' => 1,
    'name' => 'john',
    'field_company' => 'ACME Inc',
    'field_picture' => [
      'uri' => 'public://profiles/john.jpg',
      'url' => 'https://example.com/sites/default/files/profiles/john.jpg',
      'alt' => 'Tempora magni blanditiis maxime inventore.',
    ],
  ],
  'field_categories' => [
    [
      'tid' => 1,
      'name' => 'Lipsum',
      'description' => 'Quod id aspernatur laboriosam fugiat totam.'
    ],
  ],
];
          
          

Where _article is _ENTITY_BUNDLE

Examples

{{ _article.title }}
{{ _article.field_name }}
{{ _event.body.summary }}
{{ _slice.link_more.url }}
{{ _page.field_file.url }}
{{ _blog_post.field_author.field_first_name }}
{{ _hero.field_image.url }}
{{ _blog_post.field_category.name }}
{{ _page.path.alias }}

Filters

markup | truncate | words | image_style | pick | rename_keys
{{ _article.body|markup }}
{{ _article.title|truncate(120) }}
{{ _article.field_text|words(10) }}
{{ _article.field_image.uri|image_style('thumbnail') }}
{{ _article|pick(['field_text', 'field_image']) }}
{{ _article|rename_keys({field_title: 'title'}) }}

Component

card.twig
node--article.html.twig

  {% include "@components/card.twig" with {
      title: _article.title,
      image: _article.field_image.uri|image_style('medium'),
      alt: _article.field_image.alt,
      text: _article.body.value|striptags|truncate(150),
      url: _article.url,
  } %}