I have some UI elements that are used on different pages, so I put them on a separate template (partial)
inside this partial I want to have some js interactions, so I added a {% block javascripts %}
with the wanted script
The thing is, as I just include this template on the different pages I need, it doesn't extends any layout/other template
Here is my partial
<div class="ui list inverted">
{% for follow in follows.currentPageResults %}
{{ include('backend/partials/follows_pagination_item.html.twig', {series:follow.series}) }}
{% endfor %}
</div>
{% if linkToPagination is defined and linkToPagination is same as(true) %}
<div class="ui row">
<div class="ui right floated">
<a href="{{ url('admin_profile_follows', {page:1}) }}" class="ui tiny button teal">
{{ 'admin.follows.go'|trans }}
</a>
</div>
</div>
{% else %}
{% if follows.haveToPaginate %}
{{ pagerfanta(follows, 'semanticui_inverted', {'routeName': 'admin_profile_follows', 'routeParams':{'page':'page'}}) }}
{% endif %}
{% endif %}
{% block javascripts %}
{{ parent() }}
<script src="{{ asset('build/unfollow.js') }}"></script>
{% endblock %}
and I include it like this
{{ include('backend/partials/follows_pagination.html.twig', {linkToPagination:true}) }}
I need this parent (or equivalent function) because without this, the script is not added at the right place in DOM and I got the error webpackJsonp is undefined
(my js files are built with webpackEncore)
Is there a way to correctly add my script in, the javascripts block ?
If not I guess I should not use the include function, but another one?