Assembler and Template Inheritance

Is it possible to use assetic with inheritance? With the code below, I get this error:

An exception was thrown during template rendering ("Failed to create URL for the specified route" _assetic_41351d9 "because such a route does not exist.

My application layout:

{# app/Resources/views/layout.html.twig 
{% block javascripts %}
    {% javascripts
        'assets/js/jquery-2.2.0.min.js'
        'assets/js/main.js'
        output='assets/compiled/app.js'
    %}
    <script src="{{ asset_url }}"></script>
    {%  endjavascripts %}
{% endblock %}

My child layout:

{% extends "::layout.html.twig" %}
...
{% block javascripts %}
    {{  parent() }}

    {% javascripts
        'assets/js/jquery.owl.min.js'
        output='assets/compiled/page.js'
    %}
    <script src="{{ asset_url }}"></script>
    {%  endjavascripts %}
{% endblock %}
+4
source share
3 answers

Yes, you can use inheritance with Twig, and there is nothing wrong with what you are trying to do in your code. I would try to completely clear your cache and load the page again, and make sure that all the resources you need are loaded.

+2
source

, , ,

assetic:
assets:
    jquery_and_ui:
        inputs:
            - '@AppBundle/Resources/public/js/thirdparty/jquery.js'
            - '@AppBundle/Resources/public/js/thirdparty/jquery.ui.js'

jquery_and_ui :

{% javascripts
    '@jquery_and_ui'
    '@AppBundle/Resources/public/js/*' %}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}

, , , , .

LiipThemeBundle? :

# app/config/config.yml
liip_theme:
    # ...
    assetic_integration: true
+1

. javascripts .

URL- "_assetic_41351d9"

. ? .

php app/console cache:clear --env=dev

, .

0

All Articles