Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling twig template #58

Open
yadabygit opened this issue Dec 6, 2018 · 0 comments
Open

Error compiling twig template #58

yadabygit opened this issue Dec 6, 2018 · 0 comments

Comments

@yadabygit
Copy link

yadabygit commented Dec 6, 2018

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant