simon-dt / gulp-twig

Twig plugin for gulp.js, The streaming build system. Looking for maintainer or collaborators. See wiki
https://github.com/zimmen/gulp-twig/wiki/Looking-for-maintainer-or-collaborator(s)
MIT License
62 stars 33 forks source link

Error compiling twig template #58

Open yadabygit opened 5 years ago

yadabygit commented 5 years ago

I have one basic template where I connect other parts with embed and which contains several block

{# layout.html.twig #}
{# title #}
<title>
  {% block title %}{% endblock title %}
</title>

{% embed 'header.html.twig' with {'bem_parent': 'body'} %}
  {% block header_content %}
    {% embed 'logo.html.twig' with {'bem_parent': 'header'} %}{% endembed %}
  {% endblock header_content %}
{% endembed %}

{# content left #}
{% block content_left %}{% endblock content_left %}
{# header.html.twig #}
{% block header_container %}
  {% spaceless %}
    <header class="{{ bem_parent }}__header header">
      {% block header_content %}
      {% endblock %}
    </header>
  {% endspaceless %}
{% endblock %}
{% block logo_container %}
  {% spaceless %}
    <h1 class="{{ bem_parent }}__logo logo">
      ...
    </h1>
  {% endspaceless %}
{% endblock %}

I also have inheritance index.html.twig

{# index.html.twig #}
{% extends 'layout.html.twig' %}

{% block title %}
  title
{% endblock title %}

{% block content_left %}
  <aside class="page__content page__content_left">
    content left
  </aside>
{% endblock content_left %}

after compiling index .html .twig contains correct embed but in place of the block after embed is empty:

{# from inspector #}
<html lang="ru">
  <head>
    <title>
        title
    </title>
  </head>
  <body class="body">
    <header class="body__header header">
      <h1 class="header__logo logo">
        <a class="logo__link" href="javascript:void(0);">Logo</a>
      </h1>
    </header>
    <main class="body__page page">      
    </main>
  </body>
</html>